On Load error msg and Open Args

Experts, when I open this form on its own (meaning Open Args is Null) I get an error msg and the debugger highlights the bolded below.  How can I avoid this?  I thougth that the first If statement takes care of it.

Private Sub Form_Load()

        If Nz(Me.OpenArgs, "") <> "" Then
       Me.Filter = "[PrjID] = " & Split(Me.OpenArgs, ";")(0) ' & " AND [EndUserID] = " & Split(Me.OpenArgs, ";")(1) & " AND [LCNo] = " & Chr(34) & Split(Me.OpenArgs, ";")(2) & Chr(34)
       Me.FilterOn = True
     Else
              Me.PrjID = Split(Me.OpenArgs, ";")(0)             End If

End Sub
pdvsaProject financeAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
you have to remove this line

Me.PrjID = Split(Me.OpenArgs, ";")(0)    

that line is setting the value for for your PrjID from a NULL source
0
 
Dale FyeCommented:
Personally, I would test for OpenArgs is NULL, and if so, exit the sub:

 If IsNull(me.OpenArgs) Then Exit Sub

 Me.Filter = "[PrjID] = " & Split(Me.OpenArgs, ";")(0) & " AND " _
                & "[EndUserID] = " & Split(Me.OpenArgs, ";")(1) & " AND " _
                & "[LCNo] = " & Chr(34) & Split(Me.OpenArgs, ";")(2) & Chr(34)
Me.FilterOn = True
0
 
pdvsaProject financeAuthor Commented:
thank you sir...

thanks for the comment fyed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.