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 SkipVought 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 query

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
0
0
AU
Hi
on a form I use the following code:
Me.Date12 = gstrDate12 on a command button

on a second form I use this code, on Load, gstr.Date12 = Me.Date12 so that the data will roll over onto the second form.

How do I write the code when the text field has no data so that the "invalid use of null" does not appear.

Many thanks,

Ken
 
Have a look at the Nz() function.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Define gstrDate12 as a variant instead of a date.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Avoid variants whenever possible!

Gary
gwinn7
 
gwinn7, FYI, only Variant can hold null value in VBA.
 
Yes, I know! But why use a variant, when you don't need to?

Its much better programming practice to keep your data types as tight and under control as possible. The Nz option is a far better solution.

I very very rarely have to use variants in my code.

Gary
gwinn7
 
Please, reread carefully the original post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top