Solved Open customers details form when I double click on their CustomerID

NatAccessNewbie

New member
Local time
Today, 17:51
Joined
Jan 25, 2022
Messages
13
Hello
I want to be able to open a customers details by double clicking on their CustomerID from my Ongoing Orders Subform.

I've tried the code below which opens up the correct form but doesn't open to the relating customer that I clicked on. How do I define which customer's record needs to be displayed? TIA :)


Private Sub CustomerID_DblClick(Cancel As Integer)

DoCmd.OpenForm "CustomerDetailsF"

End Sub
 
I would think you would have to supply the appropriate CustomerID as part of the OpenArgs to the
DoCmd.OpenForm "CustomerDetailsF"
 
you can also use the WhereCondition parameter of the DoCmd.OpenForm method.
 
Assuming the corresponding column in the Recordsource of your form is also named CustomerID:
Code:
Private Sub CustomerID_DblClick(Cancel As Integer)
    DoCmd.OpenForm "CustomerDetailsF",,,"CustomerID=" & me.CustomerID.Value
End Sub
 
Assuming the corresponding column in the Recordsource of your form is also named CustomerID:
Code:
Private Sub CustomerID_DblClick(Cancel As Integer)
    DoCmd.OpenForm "CustomerDetailsF",,,"CustomerID=" & me.CustomerID.Value
End Sub

That works perfectly! thank you so much :)
 

Users who are viewing this thread

Back
Top Bottom