Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid use of Null 2

Status
Not open for further replies.

macleodjb

Technical User
Aug 27, 2007
10
Why do i get "Invalid use of Null" on this little snippet of code? Me.OpenArgs is not null when this is populated so i'm lost. Thanks in advance.


<code>
Private Sub Form_Load()
Direction = CStr(Me.OpenArgs)
End Sub
</code>
 
Are you sure this is the line of code where the error occurs? Are you sure it's not actually Null (i.e. in debug mode does it actually have value, or are you assuming it should have a value?)?

 
For the fun of it, put an Nz around it and see what happens.
Code:
Private Sub Form_Load()
  Direction = CStr(Nz(Me.OpenArgs,0))
End Sub

 
Thanks Joe you were right. The null was taking place where i thought but upon debug i've already passed the error so it told me that there was no null. It was giving me a null because i have a private sub with onenter event which wasn't working properly so it just proceeded directly to that sub with no value. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top