I'd like to use a combo box on a search form to list about 5 fields from a different form (Orders)...so we can match any of the fields from the combo box to the value typed into the text field...thus opening the Orders form to the correct records based on the link criterea.
That way the user can pick either the OrderDate field, or the ShipDate Field...or the PackDate field...from the drop down list....then type a date into the text box...
It would then open to the records based on that criterea when you click a button. I tried using the following code:
Private Sub Command67_Click()
On Error GoTo Err_Command67_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Orders"
stLinkCriteria = "Me![Combo61]=" & "#" & Me![Text59] & "#"
DoCmd.Openform stDocName, , , stLinkCriteria
Exit_Command67_Click:
Exit Sub
Err_Command67_Click:
MsgBox Err.Description
Resume Exit_Command67_Click
End Sub
but it doesn't work.
Any ideas? Thanks in advance.
That way the user can pick either the OrderDate field, or the ShipDate Field...or the PackDate field...from the drop down list....then type a date into the text box...
It would then open to the records based on that criterea when you click a button. I tried using the following code:
Private Sub Command67_Click()
On Error GoTo Err_Command67_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Orders"
stLinkCriteria = "Me![Combo61]=" & "#" & Me![Text59] & "#"
DoCmd.Openform stDocName, , , stLinkCriteria
Exit_Command67_Click:
Exit Sub
Err_Command67_Click:
MsgBox Err.Description
Resume Exit_Command67_Click
End Sub
but it doesn't work.
Any ideas? Thanks in advance.