If statement for e-mail

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report generated on several individuals throughout the company, but
these individuals are in different departments. Each department has it's own
e-mail address.

I already know how to use the whole report.to thing, but what I would like
to do is create an If statement for that, so I could e-mail the right report
to the right department.

Example

Dim address as string
If [form]![department] = "A" then
address = "(e-mail address removed)"
Elseif [form]![department] = "B" then
address = "(e-mail address removed)"
End if

This is actually close to the syntax I tried to use, but it's not working.
Any suggestions?
 
Nevermind folks, I figured it out (man I can be stupid sometimes).

the problem with the syntax was that I was using [form]![department] instead
of me.department.

Dim address as string.

do the if, elseif, else statements

report.to = address

and I'm good to go.
 

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

Back
Top