P
Pat Dools
Hello,
I have two issues. First, I am attempting to pass along 'Subject_ID' from
the 'fSubject_Info' form to the 'fSession_Info' form and then close the
'fSubject_Info' using the 'OpenArgs' argument of 'DoCmd.OpenForm...'. In the
code below, 'MyArgs' is getting set to the 'Subject_ID' (with a value of 2),
but it is not present for the 'OnLoad' Event of the fSession_Info' form (it
is Null). What is my code missing?
Form A ('fSubject_Info'):
Private Sub CommandOpenVisitForm_Click()
Dim MyArgs As Integer
MyArgs = Me.Subject_ID.Value
If Len(Me.Subject_LName.Value & "") = 0 Then
MsgBox "You must enter a value into Last Name."
Me.Subject_LName.SetFocus
ElseIf Len(Me.Race_ID.Value & "") = 0 Then
MsgBox "You must enter a value into Race."
Me.Race_ID.SetFocus
ElseIf Me.NewRecord = False Then
DoCmd.OpenForm "fSession_Info", , , MyArgs, acAdd
Call ClearControls(Me)
DoCmd.GoToControl "Subject_ID"
End If
Form B (fSession_Info'):
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
Me.Subject_ID = Me.OpenArgs
End If
End Sub
End result is 'Subject_ID' on 'fSession_INfo' is NULL.
The second issue is that I need to close 'fSubject_Info' once
'fSession_Info' is opened with 'Subject_ID' field being auto-populated from
the 'Subject_ID' field from 'fSubject_Info'. If 'fSubject_Info' remains
open, then when the user goes back to the Switchboard and opens
'fSubject_Info' (for the purpose of entering a new Subject), they get the
form opened with the still-active record. As always, help is greatly
appreciated.
Thank you!
I have two issues. First, I am attempting to pass along 'Subject_ID' from
the 'fSubject_Info' form to the 'fSession_Info' form and then close the
'fSubject_Info' using the 'OpenArgs' argument of 'DoCmd.OpenForm...'. In the
code below, 'MyArgs' is getting set to the 'Subject_ID' (with a value of 2),
but it is not present for the 'OnLoad' Event of the fSession_Info' form (it
is Null). What is my code missing?
Form A ('fSubject_Info'):
Private Sub CommandOpenVisitForm_Click()
Dim MyArgs As Integer
MyArgs = Me.Subject_ID.Value
If Len(Me.Subject_LName.Value & "") = 0 Then
MsgBox "You must enter a value into Last Name."
Me.Subject_LName.SetFocus
ElseIf Len(Me.Race_ID.Value & "") = 0 Then
MsgBox "You must enter a value into Race."
Me.Race_ID.SetFocus
ElseIf Me.NewRecord = False Then
DoCmd.OpenForm "fSession_Info", , , MyArgs, acAdd
Call ClearControls(Me)
DoCmd.GoToControl "Subject_ID"
End If
Form B (fSession_Info'):
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
Me.Subject_ID = Me.OpenArgs
End If
End Sub
End result is 'Subject_ID' on 'fSession_INfo' is NULL.
The second issue is that I need to close 'fSubject_Info' once
'fSession_Info' is opened with 'Subject_ID' field being auto-populated from
the 'Subject_ID' field from 'fSubject_Info'. If 'fSubject_Info' remains
open, then when the user goes back to the Switchboard and opens
'fSubject_Info' (for the purpose of entering a new Subject), they get the
form opened with the still-active record. As always, help is greatly
appreciated.
Thank you!