Check a field for a null value.

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
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?
 
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?
 
Back
Top