Reputation: 27
When the user fills out my form I have them select up to 3 email addresses from 3 combo boxes to send the report to. The selected email addresses are put into a string to go into the "To" line of the email.
This is my string:
[Email1] & ";" & [Email2] & ";" & [Email3]
It works great when the user enters 3 email addresses.
If the user selects only 1 email, I get an error. I thought if the user only selects 1 email address it would enter as a blank.
Upvotes: 0
Views: 82
Reputation: 21389
Consider:
[Email1] + ";" & [Email2] + ";" & [Email3] + ";"
If field is Null, the + concatenation will return Null and unnecessary ;
will not occur.
Concatenating a string with Null using &
returns string, whereas concatenating with +
is like addition with Null, Null is returned.
Probably should also make sure at least one email is provided before sending.
Upvotes: 1
Reputation: 27
I added ;
to the end of the emails in the table, removed the ;
from my string and this works perfect now.
Upvotes: 0