I have two forms. I am trying to open a second form based on the information I click on on the first form.
I am clicking on data in a field named "Lot_Number" and I want the second form to open with only data that contains that same "Lot_Number".
The field in both forms is named "Lot_Number".
I have tried 2 different VBA codes and an embedded Macro and I get the exact same result.
In all instances I get a Pop Up window that shows the Data I clicked on. I then have to type the data I want into the text box. Once I type it in the second form pop up with the correct data. see attachment for picture of the Pop Up. The obvious problem is that I don't want to type this data in I just want it to filter automatically. I have seen the form to form question many times on this forum but never this type of issue. Please advise. If you need a copy of the program I can cut it down and post.
The two VBAs are below:
Code 1:
Private Sub LOT_NUMBER_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim strOpenArgs As String
stDocName = "Master Temp"
stLinkCriteria = "[Lot_Number]= " & Me![LOT_NUMBER]
strOpenArgs = Me![LOT_NUMBER]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , strOpenArgs
End Sub
Code 2:
Private Sub LOT_NUMBER_Click()
DoCmd.OpenForm "Master Temp", , , "Lot_Number = " & Me.LOT_NUMBER
End Sub