By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,962 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,962 IT Pros & Developers. It's quick & easy.

Combo value

P: 77
Please help me,

What is wrong here

If Me!cboMonth.Value = Null Then
MsgBox ("Please select a month and try again.")
End If

When there is nothing selected in the cboMonth it does not go to msgbox!!!
Oct 7 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 8,679
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me!cboMonth) Then
  2.   MsgBox "Please select a month and try again."
  3. End If
Oct 7 '08 #2

Expert 2.5K+
P: 3,532
You don't say what event you have this placed in, but in Access VBA the proper syntax is

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me!cboMonth.Value) Then
  2.  MsgBox ("Please select a month and try again.")
  3. End If
Linq ;0)>
Oct 7 '08 #3

Expert Mod 2.5K+
P: 2,545
ADezii and Linq have both shown you how to test whether or not a control is null. To add to what they have posted, please be aware that Null is not a value as such (which is why you cannot test the control's value for equality with null the way you tried). Null indicates the absence of any defined value. If a control is null either it has not been filled in at all (and has no default value) or it has been cleared by the user.

The IsNull function tests for this absence of a value in a control or field (or in VBA in a variable of variant type), and is analogous in SQL to the IS NULL operator.

Oct 8 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.