Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use combo value in one form to show realted records in second form

Status
Not open for further replies.

doctorswamp

Technical User
Jul 15, 2003
133
GB
Have a form with a combo box called Customer. A command button launches a second form which I'd like to show relating to the selected customer.

In more detail, A jobs form with the Customer combo builds up items in a subform. Different jobs may have items for the same customer.

The second form shows all of the items from whatever job for any particular customer but there is no filtering so I have to move to the chosen customer's record to see all his items.

Have tried On Click procedures for the command button on the first form like

strFirstForm = "frmCustomer"

DoCmd.OpenForm strFirstForm, , ,me![Customer]

but they don't work. What's needed?
 
Your 4th parameter in your OpenForm command needs to reference a field in your table, like a Customer ID. Think of it as a WHERE clause...WHERE CustomerID = [Value selected in your combo box].

DoCmd.OpenForm strFirstForm, , , "[CustomerID]='" & me.Customer.value & "'
 
Many thanks, rjoubert, works fine now.

Extending the question a bit, again with a form showing a customer record but this time launching a second form from a subform.

The idea would be to enter partial details of an Action in a subfom, then trigger a fuller form containing more details if needed for some of the actions.

The main form is frmOrganisations, the I want to add an After Update procedure to the subform checkbox SendToOutlook to open frmScheduleOutlook to the current Organisation.

This code opens the new form to a blank page for the first entry in the subform, then works for any further entries!. Can't see why - any ideas?

************************

Dim stDocName As String
stDocName = "frmScheduleOutlook"

DoCmd.OpenForm stDocName, , , "[Organisation]='" & Forms!frmOrganisations.Organisation.Value & "'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top