I am trying to open my main form from another form. The form opened shows the ProductName and other stuff. My main form has a subform on it where products are entered. I would like to open my main form, create a new order, and display the Corresponding Products in my subform.
Form opened is InventoryReceiving, Main form is OrderDetails and subform is OrderDetailsSubform where the ProductID is located.
Here is my code now that opens my main form but not to a new record or displays the corresponding Product on the subform.
On Error GoTo Err_Command51_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "OrderDetails" 'Opens Corresponding Order
DoCmd.GoToRecord acDataForm, "OrderDetails", acNewRec
stLinkCriteria = "[ProductName]=" & Me![ProductID] 'This wont work I'm sure.
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command51_Click:
Exit Sub
Err_Command51_Click:
MsgBox Err.Description
Resume Exit_Command51_Click
____________________________________
DoCmd.OpenForm "OrderDetails", , , "[ProductID]=forms![OrderDetails].form![ProductID]" 'Trying this to see if it will work??? NOPE! It DOES NOT WORK EITHER
DoCmd.GoToRecord acDataForm, "OrderDetails", acNewRec