Results 1 to 12 of 12
  1. #1
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36

    Pull all data from every table which meets certain criteria

    Hey,

    I have a form with a combo box and some buttons. The user selects a Claim Number from the combo box and then selects a button in order to view whichever report they would like to see.



    I am now in need of a button which pulls all of the data pertaining to that Claim Number from every table in the database. So, in other words, user selects a Claim Number from the combo box, hits a button, and then gets a report that has all of the data from every single table regarding that certain Claim Number.

    My first thought was simply a query that utilizes all of the tables and in the "Criteria" field, put Like "*" & [Forms]![frmEntry1]![cboClaimNumber] & "*" Or Is Null, but apparently if you have all fields selected from each table, and multiple tables on top of that, you cannot specify certain criteria.

    Anyways, any help/guidance would be awesome. Thank you in advance.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Put the criteria in the "DoCmd.Open..." of the report. It will filter on that claim number.

  3. #3
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    Hey aytee,

    I figured that since this is basically a data dump that I would export the data (using the query) to an Excel spreadsheet using VBA. I think that might put a damper on this idea, right?

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Exporting data to Excel is, well, a dump.

  5. #5
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    Right right. Say, if I use your idea, I would create an Access report and, using VBA, would create an event within the "On Open" property?

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    No, when you are opening the report (see post #2)

  7. #7
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    Well then, I guess I don't understand what you're talking about. Because you said to put the criteria in the "DoCmd.Open..." of the report. Where "on the report" are you talking about?

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    user selects a Claim Number from the combo box, hits a button, and then gets a report
    It is all in the "gets a report". How does "gets" happen?

  9. #9
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    So, from the button then. That's all you had to say.

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Miscommunication!

  11. #11
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Wolf if you can link all of your tables by a PK, then you can use a query to select all the fields and put the combo box syntax in the criteria for the Claim Number field in the query. This should pull all data for that claim number. Once you have that, you can export that query to excel using vba. Is that what you are trying to do?

  12. #12
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    First, I would suggest setting your report source to a query that includes all of the desired records from all tables.

    For the criteria, I suggest having your button open the report using VBA. This way you can specify the criteria easily.

    Code:
    DoCmd.OpenReport "YourReportName", acViewReport, , "[YourCriteria]='" & Me.YourComboBox.Value & "'"

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

Similar Threads

  1. .EOF where it meets criteria
    By Thompyt in forum Programming
    Replies: 23
    Last Post: 09-16-2016, 04:04 PM
  2. Replies: 1
    Last Post: 06-12-2015, 02:02 PM
  3. Replies: 1
    Last Post: 05-13-2015, 02:17 AM
  4. Replies: 7
    Last Post: 12-12-2014, 11:58 AM
  5. Pull Data from another table
    By bbranco in forum Access
    Replies: 1
    Last Post: 06-19-2013, 06:15 AM

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