Phil4tektips
Technical User
This should be simple, and I bet it is!
I've been trying for a while now to take the value from an ID field across with me to another form and input it into a text box.
I only want this to happen on a particular button click, I have therefore used Openargs on in the code of the form.
The code on Click event of the button:
Private Sub Print_Risk_A4_Format_Click()
On Error GoTo Err_Print_Risk_A4_Format_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim j As Integer
j = [ID Number]
stDocName = "View Full Risk form"
DoCmd.OpenForm stDocName, , , , , , "J"
Exit_Print_Risk_A4_Format_Click:
Exit Sub
Err_Print_Risk_A4_Format_Click:
MsgBox Err.Description
Resume Exit_Print_Risk_A4_Format_Click
End Sub
This is the code for the form upon Opening:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs = "J" Then
[ID Number] = j
Else
' do nothing
End If
End Sub
The two fields are called the same name, but are obviously on different forms.
The ID Number on the first form is an Autonumber.
Can anyone help?
Thanks.
-Phil4tektips-
I've been trying for a while now to take the value from an ID field across with me to another form and input it into a text box.
I only want this to happen on a particular button click, I have therefore used Openargs on in the code of the form.
The code on Click event of the button:
Private Sub Print_Risk_A4_Format_Click()
On Error GoTo Err_Print_Risk_A4_Format_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim j As Integer
j = [ID Number]
stDocName = "View Full Risk form"
DoCmd.OpenForm stDocName, , , , , , "J"
Exit_Print_Risk_A4_Format_Click:
Exit Sub
Err_Print_Risk_A4_Format_Click:
MsgBox Err.Description
Resume Exit_Print_Risk_A4_Format_Click
End Sub
This is the code for the form upon Opening:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs = "J" Then
[ID Number] = j
Else
' do nothing
End If
End Sub
The two fields are called the same name, but are obviously on different forms.
The ID Number on the first form is an Autonumber.
Can anyone help?
Thanks.
-Phil4tektips-