openargs NOT Working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can NOT get the openargs to work. I have the following in a form called
Caller2 -
Private Sub Command0_Click()
DoCmd.OpenForm "callee", , , , , acDialog, "Joe"
End Sub

In the form Callee, in both the LOAD and OPEN events, I have
If Not IsNull(Forms!caller2.OpenArgs) Then
MsgBox "Not nada noway is it Null"
Else
MsgBox "ISz NULL"
End If


It ALWAYS says "IS NULL".

What am I doing wrong?
 
Wrong? You're getting the correct result. Your code is testing the OpenArgs
property of the form that opened this form, not the OpenArgs property of the
current form (the form that you just opened and to which the OpenArgs string
was passed by the calling form).

Change your code to this (in the Load event only; you don't need it in the
Open event):
If Len(Me.OpenArgs & "") > 0 Then
MsgBox "Not nada noway is it Null"
Else
MsgBox "ISz NULL"
End If

Note that I also changed the code to use the Len function instead of the
IsNull function. Using the Len function allows you to test for an empty
string (which is not Null) and treat it as a no OpenArgs value having been
passed to this form.
 
Thanks very much, Ken. I guess I was getting confused with whose 'openargs'
they were. Your suggested change worked.
 
Back
Top