I want the value of [ContactID] of the Calling form Form1.
How do I do this?
===============================
'Some Form (the calling form Form1)
Private Sub cmdOpenForm2_Click()
Dim strNameOfForm1 As String
strNameOfForm1 = Me.Name
DoCmd.OpenForm "Form2", , , , , , strNameOfForm1
End Sub
===============================
===============================
'Called Form (the called form Form2)
Private Sub Form2_Load()
If Not IsNull(Me.OpenArgs) Then
Dim strNameOfCallingForm As String
Dim ContactIDFromCallingForm
'Get the open arguments
'(The name of the form that called this form)
strNameOfCallingForm = Me.OpenArgs
'Find the value of the ContactID of the source form
'You can see below what I am trying to do
'But how do I do it????
'I need both the name of the calling form and an ID from that form
ContactIDFromCallingForm = Forms![Me.OpenArgs]![ContactID]
'Do other things
'Use strNameOfCallingForm for other things
'Use ContactIDFromCallingForm for other things
Else
'Do nothing
End If
End Sub
===============================
Yes, I can write a case statement with all the possibilities provided,
and all the possible expressions.
There are other convoluted ways too, but is that the most elegant way?