• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 533
  • Last Modified:

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
0
pdvsa
Asked:
pdvsa
1 Solution
 
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
 
pdvsaAuthor Commented:
thank you sir...

thanks for the comment fyed.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now