To write a condition to check for empty or null fields in access'0

G

Guest

hi, i have a query on how you can write a condtion for a macro, by which it
can check for a Null or Empty string in a field of a table. And is the field
is not empty or null to print the table to a printer.

i tried using the condtion [Reports]![repCSMCFax]![Agency]<>" " where the
report name is repCSMCFax, but the code returns a error when it is run, "Type
mismatch", where as the same code works on Access 2.0. Kindly if any of you
have faced the same problem kindly do share in. Thanks in advance
 
K

Ken Snell [MVP]

To check for either Null or empty string, use this:

Len([Reports]![repCSMCFax]![Agency] & "") = 0

Above is true if the control is empty or Null.
 
G

Guest

hi Ken,
Thanks for the snippet, but it still gives me a "Type Mismatch
Error". The problem is the data in the table are not permanent, they are
added and then at sometime deleted. So is there any issue because of that it
is not able to recognise the Null or Empty string.
And can you also suggest what should be the properties set for the
field type "Text" .

Thanks and best regadrs
Anesh

Ken Snell said:
To check for either Null or empty string, use this:

Len([Reports]![repCSMCFax]![Agency] & "") = 0

Above is true if the control is empty or Null.

--

Ken Snell
<MS ACCESS MVP>

Anesh said:
hi, i have a query on how you can write a condtion for a macro, by which it
can check for a Null or Empty string in a field of a table. And is the field
is not empty or null to print the table to a printer.

i tried using the condtion [Reports]![repCSMCFax]![Agency]<>" " where the
report name is repCSMCFax, but the code returns a error when it is run, "Type
mismatch", where as the same code works on Access 2.0. Kindly if any of you
have faced the same problem kindly do share in. Thanks in advance
 

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