Invalid use of Null

P

PC User

I get the following error: Run-time error '94' Invalid use of Null on
"strDueDate = rst!DueDate" There may be sometimes when a field has no
data. Is this the cause of the error and what can I do until I get the
right data for the field?
===============================================
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("qselNotifications")

rst.MoveFirst
Do Until rst.EOF

strProject = rst!ProgramDescription
strFacility = rst!Facility
strDueDate = rst!DueDate
strFrequency = rst!FrequencyOfService
strReciprient = rst!EmailAddress
strResponsibleParty = rst!ResponsibleParty
strSender = frm!txtWelcome
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
db.Close
Set db = Nothing
===============================================
Thanks,
PC
 
K

Ken Snell [MVP]

You cannot set a string variable to Null. So use the Nz function to replace
a Null value with an empty string.

strDueDate = Nz(rst!DueDate, "")
 

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