"Invalid use of null" when opening a form in Access 2007

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that displays a list of orders. The form has worked fine until
recently when it gave out the "Invalid use of null" error on opening. The
form triggers no events when it opens. I have created a blank database and
imported the tables, forms etc from the original to the blank hoping that the
problem may have been a glitch but that never fixed it. Can anyone help?
 
Do you have any fields with DLookup() or another domain aggregate function in
the record source?

If there are no events initiated by the form, it is probably a field looking
up a value or the form's filter setting.

Steve
 
SteveM said:
Do you have any fields with DLookup() or another domain aggregate function in
the record source?

If there are no events initiated by the form, it is probably a field looking
up a value or the form's filter setting.

Steve


Steve

I cant thank you enough. I had an aggregate function calling on a null
field. I am fairly new to databases and this (obviously) was the first time
I had run into this sort of a problem. Thanks again

Brian
 
Glad to help.

Incidentally, to protect against this error in future you can wrap your
domain aggregate function with the Nz() function (if available in your
version).

For a text field: Nz(DLookup("myField","myTable","myCriteria"),"")
For a numeric field: Nz(DLookup("myField","myTable","myCriteria"),0)

If a Null is encounterd, the first will return "" (zero length string) the
second will return '0'.

Steve
 

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

Back
Top