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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Question regarding NULL 2

Status
Not open for further replies.

Ogart

Technical User
Mar 26, 2003
104
US
Syntax...ya mean they tax that too??

Greetings:
I am trying to write a subroutine that gets triggered by clicking on an area before a "quote number" is filled in. Trouble is, my subroutine is coughing on the notion of "null", and I can't seem to get the syntax right. The line If J!QuoteNumber = Null is the problem. That gives me an error. = "" or = 0 are accepted, but they don't trigger the if correctly.

A debug.print command tells me that my field is in fact null (or has a value).

================================
Private Sub IsThereAQuoteNumber()
'This Subroutine looks for a quote number. If a quote number isn't there when a user fills in
'quote information, bad news. This is triggered by clicking on the quote detail info.

Dim J As Form
Set J = Forms!fMain

If J!QuoteNumber = Null Then
MsgBox "Don't fill in item details until you've assigned a quote number.", 48, "Warning"
End If
End Sub
================================

Thanks in advance.
 
Hi!

Try the IsNull function:

[tt]If isnull(J!QuoteNumber) Then[/tt]

Roy-Vidar
 
If QuoteNumber is a string you may want to test for empty value too:
If Len(Trim(Nz(J!QuoteNumber, ""))) = 0 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I went with Roy-Vidar's suggestion ultimately, but let the record show PH's worked too.

Stars for both. Thank you both.
CP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top