Check a field for a null value.

G

Guest

I have a combo box on a form called QuotationNumberQuery where the user
selects a reference number from the list and a button is pressed which then
displays the quoation they selected in a nice report.

I want a msg box to appear if the button is clicked when no quotation is
selected, the following code makes sense to me but does not seem to do the
job, can someone correct my code for me?

If Me.QuotationNumberQuery = Null Then
MsgBox "Get this quotation approved before you print it."
Exit Sub
End If
 
G

Guest

Hi,

That code sort of works but my custom error message is not displayed
afterwards. My code is:

If Me!QuotationNumberQuery Is Null Then
MsgBox "Please type or select from the list a valid quotation reference
number."
Exit Sub
End If

Instead, when the button is clicked the message 'Object required' appears
when instead I want my above message.
 
W

Wayne Morgan

The "Is Null" syntax would be correct for the criteria of a query. In code,
try this instead.

If IsNull(Me!QuotationNumberQuery) Then

Also, are you sure the values are Null and not zero length strings?
 
J

JohnFol

oops. Thnx Wayne

Wayne Morgan said:
The "Is Null" syntax would be correct for the criteria of a query. In
code, try this instead.

If IsNull(Me!QuotationNumberQuery) Then

Also, are you sure the values are Null and not zero length strings?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top