Report Field Control Source Property Issue

justphilip2003

Registered User.
Local time
Today, 18:35
Joined
Mar 3, 2013
Messages
30
I have a db with a Table PersonalT which has numeric values (1 to 5) in the field PoliticalPreference. In a Report I am attempting to use the codes (in Property Sheet field Control Source) to print an associated phrase. I have tried various code functions: Switch, Choose and Iff. When the Codes pass syntax check upon loading the report for execution a Message Box pops up with this message: "Enter Parameter Value". Why? Is there another property I need to fix? Here is my latest attempt:
=[Iif(PoliticalPreference=1, "Democrat", (Iif PoliticalPreference=2, "Independent”, (Iif PoliticalPreference=3, "Non Voter", (Iif PoliticalPreference=4, "Tea Party”, "Republican”))))]
Since this project is a learning tool, I do not wish to use a conversion Table since I already know how to do that. TIA :banghead:Phil
 
For starters, the square brackets around the whole bit tell Access it's a field name, which it can't find, thus the prompt. You also have the parentheses wrong on the inner functions.
 
Paul, FYI - Philip has asked this same question on another forum. We are trying to get it to work for him.
Any help you can offer would be appreciated.

Thank you,
Dale
 
Thanks for the [] observation! Whenever I attempt a correction on the given example, Access prompts me with a comment to to enclose the Iff arguments in parenthesis. Here is my latest attempt {=IIf(PoliticalPreference=1, "Democrat", (IIf(PoliticalPreference=2, "Independent”, (IIf(PoliticalPreference=3, "Non Voter", (IIf(PoliticalPreference=4, "Tea Party”, "Republican”)))))))} which puts me back to invalid syntax. All constructive observations are greatly appreciated. Beginner Phil
 
Looks okay except for all the extra parentheses. Try

=IIf(PoliticalPreference=1, "Democrat", IIf(PoliticalPreference=2, "Independent", IIf(PoliticalPreference=3, "Non Voter", IIf(PoliticalPreference=4, "Tea Party", "Republican"))))
 
Thank you very much - it works! Now to see if I can resolve the Switch and Choose Functions using lessons learned here. Phil ;)
 

Users who are viewing this thread

Back
Top Bottom