Can I use Iif statements when populating subject line?

S

Sandi V

I'm creating a form and have figured out how to populate my subject line with
the values of the form:

"Please reserve "&[Conference Room] &" "&[Meeting Date] &", "&[Meeting Start
Time] &" - "&[Meeting End Time]

I'd like to take a step further and populate the cc line with my own email
address if either the Y/N fields for Laptop and Projector are set to yes (or
is it true?) I can't seem to get the syntax right. Does Word even have an
Iif Statement?

Any help is appreciated. Thanks!
Sandi
 
G

Greg Maxey

Sub LapTopOrProjOnExit()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case "Yes"
Case oFFs("txtLaptop").Result
oFFs("txtEmail").Result = "youremailaddresswhatever"
Case oFFs("txtProj").Result
oFFs("txtEmail").Result = "youremailaddresswhatever"
Case Else
oFFs("txtEmail").Result = ""
End Select
End Sub


Sandi said:
I'm creating a form and have figured out how to populate my subject
line with the values of the form:

"Please reserve "&[Conference Room] &" "&[Meeting Date] &",
"&[Meeting Start Time] &" - "&[Meeting End Time]

I'd like to take a step further and populate the cc line with my own
email address if either the Y/N fields for Laptop and Projector are
set to yes (or is it true?) I can't seem to get the syntax right.
Does Word even have an Iif Statement?

Any help is appreciated. Thanks!
Sandi
 
M

macropod

Hi Sandi,

Try:
{IF{={IF{DROPDOWN Projector}= "Y" 1 0}+{IF{DROPDOWN Laptop}= "Y" 1 0}}> 0 "My Email Adrress"}
You can add more tests in the form of '+{IF{DROPDOWN Laptop}= "Y" 1 0}' if you need.

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.
 
G

Greg Maxey

I don't know what happened to the rest of my message :-(.

Yes there is a IF function but in case like this you might consider a Select
Case funtion.

You didn't say what type of form you are creating. I assume a protected
form with a text field for laptop an one for projector. You would run code
something like I posted on exit from each.



Sandi said:
I'm creating a form and have figured out how to populate my subject
line with the values of the form:

"Please reserve "&[Conference Room] &" "&[Meeting Date] &",
"&[Meeting Start Time] &" - "&[Meeting End Time]

I'd like to take a step further and populate the cc line with my own
email address if either the Y/N fields for Laptop and Projector are
set to yes (or is it true?) I can't seem to get the syntax right.
Does Word even have an Iif Statement?

Any help is appreciated. Thanks!
Sandi
 
S

Sandi V

Thanks, Greg. I don't know how I got my question posted to the Word group!
Maybe I just missing you! I even mentioned Word in my post!? Sorry -- I'm
very tired!

Anyway, I'm actually working on an Outlook mail form. Can you still help or
should I repost in the correct group?

Sandi

Greg Maxey said:
Sub LapTopOrProjOnExit()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case "Yes"
Case oFFs("txtLaptop").Result
oFFs("txtEmail").Result = "youremailaddresswhatever"
Case oFFs("txtProj").Result
oFFs("txtEmail").Result = "youremailaddresswhatever"
Case Else
oFFs("txtEmail").Result = ""
End Select
End Sub


Sandi said:
I'm creating a form and have figured out how to populate my subject
line with the values of the form:

"Please reserve "&[Conference Room] &" "&[Meeting Date] &",
"&[Meeting Start Time] &" - "&[Meeting End Time]

I'd like to take a step further and populate the cc line with my own
email address if either the Y/N fields for Laptop and Projector are
set to yes (or is it true?) I can't seem to get the syntax right.
Does Word even have an Iif Statement?

Any help is appreciated. Thanks!
Sandi
 
S

Sandi V

Sorry -- I meant to post to the Outlook group. I'm working on an Outlook
mail form. I'll try your syntax there; and if it doens't work; post to the
right group. Thanks for your reply!

macropod said:
Hi Sandi,

Try:
{IF{={IF{DROPDOWN Projector}= "Y" 1 0}+{IF{DROPDOWN Laptop}= "Y" 1 0}}> 0 "My Email Adrress"}
You can add more tests in the form of '+{IF{DROPDOWN Laptop}= "Y" 1 0}' if you need.

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


Sandi V said:
I'm creating a form and have figured out how to populate my subject line with
the values of the form:

"Please reserve "&[Conference Room] &" "&[Meeting Date] &", "&[Meeting Start
Time] &" - "&[Meeting End Time]

I'd like to take a step further and populate the cc line with my own email
address if either the Y/N fields for Laptop and Projector are set to yes (or
is it true?) I can't seem to get the syntax right. Does Word even have an
Iif Statement?

Any help is appreciated. Thanks!
Sandi
 
D

Doug Robbins - Word MVP

You will be more likely to get a response for how to do it with an Outlook
form if you post to an Outlook Newsgroup.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Sandi V said:
Thanks, Greg. I don't know how I got my question posted to the Word
group!
Maybe I just missing you! I even mentioned Word in my post!? Sorry --
I'm
very tired!

Anyway, I'm actually working on an Outlook mail form. Can you still help
or
should I repost in the correct group?

Sandi

Greg Maxey said:
Sub LapTopOrProjOnExit()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case "Yes"
Case oFFs("txtLaptop").Result
oFFs("txtEmail").Result = "youremailaddresswhatever"
Case oFFs("txtProj").Result
oFFs("txtEmail").Result = "youremailaddresswhatever"
Case Else
oFFs("txtEmail").Result = ""
End Select
End Sub


Sandi said:
I'm creating a form and have figured out how to populate my subject
line with the values of the form:

"Please reserve "&[Conference Room] &" "&[Meeting Date] &",
"&[Meeting Start Time] &" - "&[Meeting End Time]

I'd like to take a step further and populate the cc line with my own
email address if either the Y/N fields for Laptop and Projector are
set to yes (or is it true?) I can't seem to get the syntax right.
Does Word even have an Iif Statement?

Any help is appreciated. Thanks!
Sandi
 

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

Top