Try:
If Len(Trim(Forms![NameOfForm]![NameOfControl] & vbNullString)) > 0 Then
' Run your code
End If
--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
Co-author: Access 2010 Solutions, published by Wiley
(no e-mails, please!)
"alex" <(E-Mail Removed)> wrote in message
news:eb0b4d0d-080b-4f94-b851-(E-Mail Removed)...
Check for spaces
Hi,
Using Access 03
I have some code behind a Form that checks the value of several
unbound text/combo boxes.
If the control = Null or then the code doesnt run (pretty simple).
My problem, however, is that my code will run (allow) when a user
simply enters a space(s) (hitting spacebar once or multiple times).
How can I avoid this?
The code I referenced is mostly SQL code, so when I DIM the variables,
I usually set them to zls to avoid invalid use of null errors; e.g.,:
nz(myUnboundControl,). But I need the code to be smart enough to
ignore nulls, zls, or spaces.
Any Thoughts?
Thanks,
alex