Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUB TO CHECK ALL FIELD ARE COMPLETE 2

Status
Not open for further replies.

jailerg013

Technical User
Nov 19, 2003
16
US
Could anyone get me started on writing a sub to check if the following fields are complete.
Something like this:
Code:
If Me![Mydate] = Null Or Me![StartTime] = Null Or Me![EndTime] = Null Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If
I'm probably not even close, could you please help me?
 
Hi,
Actually you're pretty close. The only thing is that you can't say &quot;If <whatever> = Null&quot; because Null does not equal anything, (including another null).

What you need to do is use the IsNull function, like so:


If IsNull(Me![Mydate]) Or IsNull(Me![StartTime]) or
IsNull(Me![EndTime]) Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If

Good Luck,
Tranman
 
The above code will do a great job of checking for Null, but do you also want to check for an EmptyString (&quot;&quot;) in the textbox, or a textbox with only spaces in it?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thank you, I've got it working. Thanks for your time. [2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top