(supposedly easy) list box selection detail

MikeLeBen

Still struggling
Local time
Today, 13:29
Joined
Feb 10, 2011
Messages
187
I have set up a form with two text boxes for the user to input the issue date or delivery date and lookup for that values in a tblOrders.

User can type a date (or choose from the pop-up date picker) and then clicking on a button he populates a list box which shows the orders for that date.

I am now trying to allow the user to select the order she/he wants from the list box and see its details by clicking on another button that unhides the detail subform.

tblOrders is linked to tblOrder_Products that is a junction table to tblProducts.

The junction table holds the detailed information for a given order, so the list box selects tblOrders.OrderID that is the foreign key to the detailed info table.

What's the code for storing this ID and passing it as the subform source?
 
You could use the following code in the On Dbl Click event of your List Box;
Code:
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Your FormName"
    
    stLinkCriteria = "[YourID]=" & Me![YourID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
or the On Click event of a Button, Although if you put this code in a button you will need to do a test to ensure that the user has made a selection from the List Box.
 
Thanks for your reply, good solution
 

Users who are viewing this thread

Back
Top Bottom