Link to home
Start Free TrialLog in
Avatar of Rachel Alldredge
Rachel Alldredge

asked on

Can I override the Runtime Error '94- Invalid use of NULL when sending emails from Access?

I have a macro set up to send out an email from Access. There are several variables within the email however not all of the variables will always have data populated. For example- a phone number with an extension.  Not all phone numbers will have an extension as they may be a direct line.  

How can I bypass this error and have the e-mail simply leave that section blank if there is no data to populate?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try using the Nz() function when passing information

nz([phone],"")
Invalid use of NULL

Open in new window

One way , although not tried from my side.
If fields come from tables, try to make it pull from a query on those tables. Make the query fields as Nz(field).
Select Nz(fld1) as fld1, Nz(fld2) As fld2, ....

This way you preserve most of coding, including field names.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial