Type mismatch (1 Viewer)

Gismo

Registered User.
Local time
Today, 11:03
Joined
Jun 12, 2017
Messages
1,298
Hi All,

I have a form there 2 drop downs must populated before the save button is viable.
Both drop downs are text field.
When the fields are empty there is no problem but when the fields have been populated, i get a vb error "Type mismatch"

Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please feel free to Remove this Comment
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/

Code:
# If IsNull(Me.CSAeMail) Or (Me.CSMeMail) Then
Me.SaveBTN.Visible = False
Else
Me.SaveBTN.Visible = True
End If
End Sub#
 
Last edited by a moderator:

Isaac

Lifelong Learner
Local time
Today, 01:03
Joined
Mar 14, 2017
Messages
8,777
Try changing it to:
Code:
If (IsNull(Me.CSAeMail)) Or (isnull(Me.CSMeMail)) Then
Me.SaveBTN.Visible = False
Else
Me.SaveBTN.Visible = True
End If
End Sub

Some of my paren's may be unnecessary, but will work. I tend to err on the side of caution with multiple boolean statements.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:03
Joined
Sep 21, 2011
Messages
14,267
You have to use ISNULL on both controls
 

Gismo

Registered User.
Local time
Today, 11:03
Joined
Jun 12, 2017
Messages
1,298
Try changing it to:
Code:
If (IsNull(Me.CSAeMail)) Or (isnull(Me.CSMeMail)) Then
Me.SaveBTN.Visible = False
Else
Me.SaveBTN.Visible = True
End If
End Sub

Some of my paren's may be unnecessary, but will work. I tend to err on the side of caution with multiple boolean statements.
Great stuff, makes sense, thank you
 

Users who are viewing this thread

Top Bottom