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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
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
 
Back
Top