I'm trying to make a mini search form that opens my main form, Orders. I made a simple text box to enter the order ID . The problem is that the Orders Form expects to be opened from another source, so it is looking for the parameter CustomerID. I'm using this code on the button.
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Orders"
stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.Openform stDocName, , , stLinkCriteria
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
It gives an error
"Enter Parameter Value" Forms!OrdersbyCustomer!CustomerID
Is there a way to prevent that and pass the value from the mini search form?
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Orders"
stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.Openform stDocName, , , stLinkCriteria
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
It gives an error
"Enter Parameter Value" Forms!OrdersbyCustomer!CustomerID
Is there a way to prevent that and pass the value from the mini search form?