verifying contents of fields

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hey all,
I am working on a database that uses the same form to
display data already in the database, or can be used to
enter in data to the db. I wanted to keep the info from
automatically being entered in. i did this by creating a
command button that would enter all the info in once i
have verified that the fields were not empty. When i
tested this, i did: if Summary.Text = "" or Summary.text
= Null then.... I was just verifying that i would pick
up an empty field. For some reason, it doesn't see either
one of those, even though the debugger says that the field
is NULL. Anyone know why this is, or how i can get around
it?
 
Why not just set your required fields to be required in the table?

Of in the form for any required field, put the validation rule to not ""


Rick B


Hey all,
I am working on a database that uses the same form to
display data already in the database, or can be used to
enter in data to the db. I wanted to keep the info from
automatically being entered in. i did this by creating a
command button that would enter all the info in once i
have verified that the fields were not empty. When i
tested this, i did: if Summary.Text = "" or Summary.text
= Null then.... I was just verifying that i would pick
up an empty field. For some reason, it doesn't see either
one of those, even though the debugger says that the field
is NULL. Anyone know why this is, or how i can get around
it?
 
Use the IsNull() function:
If IsNull(Me.Summary) Then ...

For an explanation of why nothing is ever equal to null, see:
Common errors with Null
at:
http://allenbrowne.com/casu-12.html


BTW, unlike pure VB, you generally don't need the ".Text" bit in Access.
That refers only to the unvalidated text that is actually in a text box or
combo while it has the focus. The default property is ".Value".
 
Worked like a charm. Thanks!

-----Original Message-----
Use the IsNull() function:
If IsNull(Me.Summary) Then ...

For an explanation of why nothing is ever equal to null, see:
Common errors with Null
at:
http://allenbrowne.com/casu-12.html


BTW, unlike pure VB, you generally don't need the ".Text" bit in Access.
That refers only to the unvalidated text that is actually in a text box or
combo while it has the focus. The default property is ".Value".

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top