data transfer from access to excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • okan
    New Member
    • Feb 2007
    • 7

    data transfer from access to excel

    Hi everyone.
    My question is that i have a form which includes subform,too. in this form for example i choose a country and in the subform its capital, currency,presid ent are shown. and i have a button to transfer infos to the excel. the problem is here. because when i click, it doesn't send infos from subform,it sends whole country's infos. how can i solve this?

    thanks
  • okan
    New Member
    • Feb 2007
    • 7

    #2
    can anybody help me please?

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      First, have patience because there are posts earlier than yours that should be answered first. The people here are volunteering their time.

      Second, you say your code isn't working but you didn't paste your code so we can see where it went wrong.

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by okan
        Hi everyone.
        My question is that i have a form which includes subform,too. in this form for example i choose a country and in the subform its capital, currency,presid ent are shown. and i have a button to transfer infos to the excel. the problem is here. because when i click, it doesn't send infos from subform,it sends whole country's infos. how can i solve this?

        thanks
        As far as I know you can't output the subform record without the main form record. However, as Rabbit says post the code you are using and we'll see if there if an alternative.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32656

          #5
          Let me post in two parts :

          First as a moderator.
          As Rabbit said, please do not post your impatience one hour after your question was originally posted. This will not help your cause and is only likely to make our volunteer helpers impatient with you.
          If you have a question which has received no response for 24 hours then feel free to post a simple bump to bring it back to the attention of our experts.

          Second as an expert.
          If you build your subform on a QueryDef which exactly matches the data you want to export, then you should get what you need. If this cannot be achieved for any reason, then as the others have said, you will need to let us see the code you're currently using for us to help you.

          Comment

          • okan
            New Member
            • Feb 2007
            • 7

            #6
            sorry for my impatience.

            code is here

            Code:
            Dim oApp As Object
            
                Set oApp = CreateObject("Excel.Application")
                DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Subform1", "c:/deneme/result.xls", True
                oApp.Application.Workbooks.Open ("c:/example/result.xls")
                oApp.Visible = True
            this is the main part of code. I have subform1 and i try to pass all fiedls to excel. but as i said before i want to send only country infos which i choose in the from when i run the code. It should send all countries' infos to excel

            thanks for tips
            Last edited by NeoPa; Feb 9 '07, 02:04 PM. Reason: Tags

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32656

              #7
              I would guess from your code that you get an error when trying to run this code as (unless "Subform1" is a Table or QueryDef), this is not a valid parameter.
              Other than that we're still running on little to no information.
              You should really be determining for yourself before posting what information is required. We can help if you get it a little wrong, but we can't go through a process of detailed instruction for everyone who posts questions. The overhead would be too onerous.
              Obviously code is required so thanks for that. You've hinted at where this code is run from, though the procedure name line would have been more helpful.
              We need details about what you have on your form and subform and how the records of the subform are restricted (filtered) if they are. You may also need to provide Table MetaData to help us to understand how your form fits in.
              Posting Table/Dataset MetaData
              Code:
              [b]Table Name=tblStudent[/b]
              StudentID; Autonumber; PK
              Family; String; FK
              Name; String
              University; String; FK
              MaxMark; Numeric
              MinMark; Numeric
              Also, if your code gives an error while compiling or running, we need that too.
              Remember, we are happy to help you with our experience, but debugging remotely is very difficult if we don't even have the basic information. I appreciate you may not know exactly what we need, but if you make an attempt to think about what is required (you, after all, are the only one who knows all the details, including what may, or may not, be relevant) we can help you on from there.
              This may seem like a lot of trouble to go to, to get a problem solved, and if you feel it's not worth the trouble then we fully understand.

              Comment

              Working...