How to determine if a user has entered a value in a field on a form

C

Chrisso

Hi All

How can I determine if a user has entered a value in a field on a form?

I have a field which is just a text box which sits on a field in a
table. I want my VB code to check whether anything has been entered by
the user as an interim check - I do more secure checking with the field
details in the table of course.

I have tried:
Me.MyField = ""
Me.MyField Is Nothing
Me.MyField Is Null
Me.MyField = Nul
and even tried Len on Me.MyField - all to no avail.

This should be easy - what am I missing? Thanks for any and all help.

Chrisso
 
D

Douglas J. Steele

If IsNull(Me.MyField) Then
' MyField is empty
End If

or (my preference)

If Len(Me.MyField & vbNullString) = 0 Then
' MyField is empty
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top