A
Amanda Byrne
I have an Animal Record form that shows the record for an individual animal.
I created a command button that opens the Animal Journal form.
I need to preset the values in the Animal Journal form so that the [Animal
Journal].[Animal ID] field is automatically set to the Animal ID from the
Animal Record form, and I would also like to display the Animal Record Name
on the Animal Journal form.
I played around with the OpenArgs property of my DoCmd.Open, but this does
not seem to work.
Here's the code:
Private Sub Add_AJ_Entry_Click()
On Error GoTo Err_Add_AJ_Entry_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Animal Journal"
stLinkCriteria = "[Animal Records.Animal ID]=" & Me![Animal ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Exit_Add_AJ_Entry_Click:
Exit Sub
Err_Add_AJ_Entry_Click:
MsgBox Err.Description
Resume Exit_Add_AJ_Entry_Click
End Sub
I created a command button that opens the Animal Journal form.
I need to preset the values in the Animal Journal form so that the [Animal
Journal].[Animal ID] field is automatically set to the Animal ID from the
Animal Record form, and I would also like to display the Animal Record Name
on the Animal Journal form.
I played around with the OpenArgs property of my DoCmd.Open, but this does
not seem to work.
Here's the code:
Private Sub Add_AJ_Entry_Click()
On Error GoTo Err_Add_AJ_Entry_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Animal Journal"
stLinkCriteria = "[Animal Records.Animal ID]=" & Me![Animal ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Exit_Add_AJ_Entry_Click:
Exit Sub
Err_Add_AJ_Entry_Click:
MsgBox Err.Description
Resume Exit_Add_AJ_Entry_Click
End Sub