Unable to Identifying value in control

grenee

Registered User.
Local time
Today, 08:53
Joined
Mar 5, 2012
Messages
212
Good Day All.

I want my code to display a message if the value in the control is Null. I test the code with a Null value in the control and the message is not displayed; it just by-passes the if function code and goes on to the remainder of the module code.

Strange enough I tried the following contradiction:

if control = NULL
if not control = Null
if control = ""
If control <> ""
If control = 0
if control <>0

yet the if function is still ignored and the code after it is selected.

here is actual code I tried:

Private Sub SignIn_Click()
If Me.Text6 = Null Then
MsgBox "George"
Else
Msgbox "Michael"

End If
End Sub


MIchael is the message given under all the conditions listed above.

Can anyone help.
 
For the record, *nothing* is ever = to Null, including Null.
Try: If Me.Text6 & "" = "" Then
 
Thanks Rural Guy. It worked instantly. I am relieved.
 
FYI, Allan's code is one of several preferred, as it actually will work not only if the Control is Null, but also if it contains a Zero-Length String. i.e. "". But the Access VBA function/syntax for this would be

If IsNull(Me.Text6) Then

Most of us use some variation of Allan's suggestion, all or most of the time, but in situations where a Zero-Length String is impossible (say when checking the state of an Option Group, or, in most cases, of a Combobox) then IsNull() will work fine.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom