473,700 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

=Iff(([Me]![Gender])="M","Male","F emale")

Thanks in Advance! ... I have two textboxes: 1 is visible (and gets its
value based on the invisible textbox and displays either "Male" or
"Female", and needs to display either male of female based on the value
that comes up in the tables record as "M" or "F".
I tried:

=Iff(([Me]![Gender])="M","Male","F emale")

'the [Me] is form, [Gender] is the textbox name

and this does not work.

Is my syntax wrong or can I just have one box and its displayed value
display "Female" if the record says "F"?
Thanks! Brian

Dec 30 '05 #1
22 22348
BB
When you say it doesn't work, do you mean the visible text box is
empty? Or, does it display an error?

Out of curiousity, why are you using two text boxes? I think it might
be simpler to use a single combo box. Make its properties like so:

Control Source: Gender
Row Source Type: Value List
Row Source: "M";"Male";"F"; "Female"
Column Count: 2
Column Heads: No
Column Widths: 0"
Bound Column: 1

This will give you a drop down list with two rows. Since the Column
Count is 2, the "M" and "Male" values are the two columns for the first
row and the "F" and "Female" are the two columns for the second row.
Setting the Column Width to 0" means the first column will not be
displayed but since it's the Bound Column, the "M" and "F" will be used
as the value of the Gender field. Hope this makes sense.

Dec 30 '05 #2
I just want two display "Male" in my textbox if the value in the table
is "M".

Dec 30 '05 #3
BB
OK, and I think I just spotted your problem. Try "IIf" instead of
"Iff."

Dec 30 '05 #4

<ca************ ***@yahoo.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
I just want two display "Male" in my textbox if the value in the table
is "M".

Brian, I don't think you need two textboxes. Assuming Gender is the field
name and is required, set the control source to:

IIf([Gender]="M", "Male", "Female")
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

Dec 30 '05 #5
You're write, that was a misstake, but it didn't fix it. I still just
get the dreaded #Name? in my textbox...

Dec 30 '05 #6
It works now! .... Sorry I left off the "="
=IIf([Gender]="M","Male","Fe male")... Thanks!

Dec 30 '05 #7
ca************* **@yahoo.com wrote:
It works now! .... Sorry I left off the "="
=IIf([Gender]="M","Male","Fe male")... Thanks!


Make sure you pay attention to Randy Harris's post! 8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Dec 30 '05 #8
On 30 Dec 2005 11:23:17 -0800, ca************* **@yahoo.com wrote:
Thanks in Advance! ... I have two textboxes: 1 is visible (and gets its
value based on the invisible textbox and displays either "Male" or
"Female", and needs to display either male of female based on the value
that comes up in the tables record as "M" or "F".
I tried:

=Iff(([Me]![Gender])="M","Male","F emale")

'the [Me] is form, [Gender] is the textbox name

and this does not work.

Is my syntax wrong or can I just have one box and its displayed value
display "Female" if the record says "F"?

Thanks! Brian


1) You cannot use the Me keyword in an Access control source.
And as has already been pointed out by others, the function is IIF not
IFF.
Try:
=IIf(([Gender]="M","Male","Fe male")
Make sure the name of this control is not "Gender".

2) Why a field that stores "M" or "F"? Why not just simply store
"Male" or "Female"? Or since there are only the 2 choices, why not a
Check Box field? Then in a regular unbound text control on your
report, set the control source to the CheckBox field and have it's
Format property set to:
;"Male";"Female "
assuming Male is the checked value.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Dec 30 '05 #9
I just use a bit field named Male with conditional formatting to turn
the background color of all fields blue when Male is true, (while their
default backbround color is pink).
Oh yeah, in the form header I have two images, one of King Kong and the
other of Jessica Lange; their visibility is controlled by Male - Yes or
No.
Works great; you'd be surprised how impressed prospective clients are.
Their eyebrows go right up.

HTH

Kyle

Dec 30 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.