Why doesn't this work?

dbay

Registered User.
Local time
Today, 12:50
Joined
Jul 15, 2007
Messages
87
Private Sub CMD_Submit_Click()

Dim STR_Enter As String

If Me.TXT_Test.Value = "" Then
STR_Enter = "Test Textbox"
End If

If STR_Enter = "" Then
MsgBox ("Empty")
Else
MsgBox ("MUST ENTER: " & STR_Enter & "")
End If

End Sub

It only catches it when you use <> not "" in the first IF statement. Why?
 
If the box has a Null it won't work.
Use this:

If Len(Me.TXT_Test & "") = 0 Then
 
You can replace
If Me.TXT_Test.Value = "" Then

with this:
Code:
If IsNull(Me.TXT_Test.Value) OR IsEmpty(Me.TXT_Test.Value) Then

A
 
Thanks for the replys. These will be very useful. I don't know why I didn't think of any other options...
 

Users who are viewing this thread

Back
Top Bottom