Results 1 to 4 of 4
  1. #1
    Mkeyur is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2017
    Posts
    2

    Exporting results of a Filtered sub-form using Button in Access 2007


    I am Preparing a database software in Access 2007, I have prepared a continuous form (Lets say A) which gives me all the entries in my database. I also prepared another form (Lets say B) which uses Form A as Sub-form. The user enters the keyword in Form B and the filtered results are displayed in sub-form. The problem is I want to export this filtered sub-form in Excel. I tried using "DoCmd.Outputto" command. but on using acOutputForm command it gives me either entire form A or Form B, but not the filtered results that I want. acOutputSubform does not exist and also the sub-form does not have any different name. How can I export this file?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Using OutputTo: for the ObjectName parameter, "If you want to output the active object, specify the object's type for the ObjectType argument and leave this argument blank"

  3. #3
    Mkeyur is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2017
    Posts
    2
    I tried doing it. My code was: "DoCmd.OutputTo acOutputForm" As guided by you I did not specify file name. But by doing this it is giving me contents of my main form as output and not the subform.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Makes sense, it is the active object that is being exported. If the main form is unbound you can use the same filtering as the subform by adding it to the record source. Or make the subform the active object, could be Me!subform.Setfocus?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 04-07-2017, 08:00 AM
  2. Exporting filtered results to Excel
    By doublec9 in forum Import/Export Data
    Replies: 2
    Last Post: 06-04-2013, 09:05 PM
  3. Replies: 3
    Last Post: 02-09-2013, 09:23 PM
  4. Replies: 9
    Last Post: 08-06-2011, 02:10 PM
  5. Replies: 3
    Last Post: 11-17-2010, 05:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums