Sweetnuff38
Registered User.
- Local time
- Today, 08:37
- Joined
- Dec 7, 2007
- Messages
- 74
I have a form with a button that has an onclick procedure that will open another form and show the matching primary keys (when there is data relating to that key). I should mention that both forms are attached to different queries (tables).
My problem is when adding a new record in the first form, I would like the primary key to automatically populate from the form I am working on to the other form so I dont have to fill it in.
This is the code behind the button now, what would I need to add to accomplish the above? Any help would be appreciated.
Private Sub cmdassessmentform_Click()
On Error GoTo Err_cmdassessmentform_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmInspectionAssessment"
stLinkCriteria = "[IItemNumber]=" & Me![IItemNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdassessmentform_Click:
Exit Sub
Err_cmdassessmentform_Click:
MsgBox Err.Description
Resume Exit_cmdassessmentform_Click
End Sub
My problem is when adding a new record in the first form, I would like the primary key to automatically populate from the form I am working on to the other form so I dont have to fill it in.
This is the code behind the button now, what would I need to add to accomplish the above? Any help would be appreciated.
Private Sub cmdassessmentform_Click()
On Error GoTo Err_cmdassessmentform_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmInspectionAssessment"
stLinkCriteria = "[IItemNumber]=" & Me![IItemNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdassessmentform_Click:
Exit Sub
Err_cmdassessmentform_Click:
MsgBox Err.Description
Resume Exit_cmdassessmentform_Click
End Sub