If statement for e-mail

C

coconut78

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 = "[email protected]"
Elseif [form]![department] = "B" then
address = "[email protected]"
End if

This is actually close to the syntax I tried to use, but it's not working.
Any suggestions?
 
C

coconut78

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.
 
Top