is null error: object required

R

Raul Sousa

I have the above expression.
If Me.DocID Is Not Null Then

It gives me an error: Object required.

Does anyone know what does it mean?
 
K

Klatuu

Me. refers to the current form or report. If this code is not in a form or
report, you will have to change Me. to explicitly reference the form or
report you want.

DocID is not a property or method of a form or report. How have you defined
DocId?
 
A

Allen Browne

Try:
If IsNull(Me.DocID) Then

The Is Not Null syntax works in a query, but not in VBA code.

(The Is operator in VBA is used for comparing objects, so that's what the
cryptic error message meant.)
 
R

Raul Sousa

Thank you for your reply.
Is there a is not null?
like: If IsNotNull(Me.DocID) Then

"Allen Browne" escreveu:
 
R

Raul Sousa

Thank you Allen,

In VBA Code the options are isnull() and isnotnull()?

"Allen Browne" escreveu:
 
A

Allen Browne

No. You use:
IsNull()
or
Not IsNull()

There is no function called IsNotNull().
 
Top