Results 1 to 3 of 3
  1. #1
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    50

    Select a specific report based on a field in the Underlying table

    I have 2 reports. I would like the user to select a product and the one of the two reports to print based on a field in the source table.



    The 2 reports are named
    rptMVSalesOrders1
    rptMVSalesOrders2

    fld1CD is the field in the underlying table

    If fld1CD = < 100 then
    stDocName = "rptMVSalesOrders1"
    DoCmd.OpenReport stDocName, acPreview

    else

    stDocName = "rptMVSalesOrders2"
    DoCmd.OpenReport stDocName, acPreview
    Endif

    I'm not sure how to get the value of fld1CD

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    10,187
    Some related table data would help as I can't see the relationship between the underlying field and the report here. Is field1CD the product ID, or related to the product somehow?
    All I can suggest is that DLookup may be the answer, but I can't be more specific than that.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    15,899
    As micron says - we're not sure of fld1CD. Normally, if you want the user to select something(s) that result in a report, you would set up a form. The form would present some options, and based on what was selected, you would open the related report....

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

Similar Threads

  1. Replies: 10
    Last Post: 10-26-2019, 12:15 PM
  2. Replies: 17
    Last Post: 12-09-2015, 10:44 AM
  3. Replies: 6
    Last Post: 12-06-2015, 08:21 PM
  4. Replies: 7
    Last Post: 11-24-2014, 02:11 PM
  5. Sub form based on table select specific records
    By ReluctantGeek in forum Forms
    Replies: 0
    Last Post: 01-21-2012, 11:24 AM

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