Hi all,
I have a report which users of the database need to be able to email. I have the SendObject all set up, minus one little problem I'm having. The e-mails that the report has to be sent to are entered into the database, and there are up to 4 e-mails that the report may have to go to at one time.
There are 4 fields labeled Email, Email2, Email3, and Email4. I've been trying to work a Switch() function into the TO: area in the VBA, but I can't seem to get it to work. Currently, I have the function set up like this:
It goes on to also include Email3 and Email4, but when I run it I either get a blank to field, or the debugger comes up and tells me that the Sub or Function [Email4] is not defined.
Any help is greatly appreciated, thanks.
Edit: No longer getting the undefined sub or function popup, but I am still getting a blank To:. I tried changing it to simply
but Outlook refuses to accept an e-mail that is blank, so that doesn't work either.
I have a report which users of the database need to be able to email. I have the SendObject all set up, minus one little problem I'm having. The e-mails that the report has to be sent to are entered into the database, and there are up to 4 e-mails that the report may have to go to at one time.
There are 4 fields labeled Email, Email2, Email3, and Email4. I've been trying to work a Switch() function into the TO: area in the VBA, but I can't seem to get it to work. Currently, I have the function set up like this:
Code:
Switch([Email]=Not Null And [Email2]=Null, [Email], [Email2]=Not Null And [Email3]=Null, [Email] & "; " & [Email2]...)
It goes on to also include Email3 and Email4, but when I run it I either get a blank to field, or the debugger comes up and tells me that the Sub or Function [Email4] is not defined.
Any help is greatly appreciated, thanks.
Edit: No longer getting the undefined sub or function popup, but I am still getting a blank To:. I tried changing it to simply
Code:
[Email] & "; " & [Email2] & "; " & [Email3] & "; " & [Email4]
Last edited: