Nulls problem - easy one!

S

Simon

Can anyone help me with this one please?

I need to return the string "Record is Null" is the field is in fact a Null
but I keep getting an "object required" error message.

I am using the following code.

If oRs("Individual_Title") Is Not Null Then strIndividual_Title =
oRs("Individual_Title") Else strIndividual_Title = "Record is Null"

Thanks
 
D

Douglas J. Steele

If IsNull(oRs("Individual_Title")) = False Then
strIndividual_Title = oRs("Individual_Title")
Else
strIndividual_Title = "Record is Null"
End If

or, much simpler,

strIndividual_Title = Nz(oRs("Individual_Title"), "Record is Null")
 
E

Elwin

The error message you're getting is a result of your not setting your
recordobject.

eg) Set oRS = CurrentDb.OpenRecordset("MyTable",dbOpenSnapshot)
 

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