473,388 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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

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","Female")

'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 22220
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*********************@f14g2000cwb.googlegro ups.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","Female")... Thanks!

Dec 30 '05 #7
ca***************@yahoo.com wrote:
It works now! .... Sorry I left off the "="
=IIf([Gender]="M","Male","Female")... 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","Female")

'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","Female")
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
BB
>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.


You'll have to update that to Naomi Watts now.

Dec 31 '05 #11
I don't want to hurt Jessica's feeling so I'll use one of each!

Dec 31 '05 #12
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
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.


Why not checked = Female?

I would never represent something that is neutral by using a
Boolean.

Second, in cases where the value is unknown, there is no way to
store that using a Boolean field.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 31 '05 #13
"Lyle Fairfield" <ly***********@aim.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:
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.


I'll bet they do.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 31 '05 #14
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote
;"Male";"Female"
assuming Male is the checked value.
Why not checked = Female?


If I understood correctly, he was explaining why he used the particular
format. If so, the answer to your question would be: Because that Format
doesn't work if "checked = Female"; it would be ;"Female";"Male".
I would never represent something that is neutral by using a
Boolean.
What's neutral in this case?
Second, in cases where the value is unknown, there is no way to
store that using a Boolean field.


Unknown, I can understand; neutral, I can't, without explanation.

Larry
Dec 31 '05 #15
"Larry Linson" <bo*****@localhost.not> wrote in
news:rJptf.1944$aB1.729@trnddc02:
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote
;"Male";"Female"
assuming Male is the checked value.


Why not checked = Female?


If I understood correctly, he was explaining why he used the
particular format. If so, the answer to your question would be:
Because that Format doesn't work if "checked = Female"; it would
be ;"Female";"Male".


???

The issue was about using a Boolean to represent the two values,
male or female. The suggestion was that TRUE would indicate
maleness. My question is only over why male was chosen as TRUE and
female as FALSE.

I don't want to sound politically correct or anything, but it's
exactly the kind of thing that I find annoying, because of the
assumption that the male case should be the TRUE one.

In any event, I believe that it's *not* a Boolean value, so it
oughtn't be stored in a Boolean field.
I would never represent something that is neutral by using a
Boolean.


What's neutral in this case?


Sex. Male is neither better nor worse than female. Maleness is not a
negation of femaleness.
Second, in cases where the value is unknown, there is no way to
store that using a Boolean field.


Unknown, I can understand; neutral, I can't, without explanation.


There's an unintended implied value judgement in making one of them
TRUE and one FALSE, seems to me, and it would be better to avoid
such assumptions.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 31 '05 #16
I agree David. I, for one, have never had a female lie to me!

Dec 31 '05 #17
On Sat, 31 Dec 2005 14:20:48 -0600, David W. Fenton wrote:
"Larry Linson" <bo*****@localhost.not> wrote in
news:rJptf.1944$aB1.729@trnddc02:
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote
;"Male";"Female"
assuming Male is the checked value.

Why not checked = Female?
If I understood correctly, he was explaining why he used the
particular format. If so, the answer to your question would be:
Because that Format doesn't work if "checked = Female"; it would
be ;"Female";"Male".


???

The issue was about using a Boolean to represent the two values,
male or female. The suggestion was that TRUE would indicate
maleness. My question is only over why male was chosen as TRUE and
female as FALSE.

I don't want to sound politically correct or anything, but it's
exactly the kind of thing that I find annoying, because of the
assumption that the male case should be the TRUE one.

In any event, I believe that it's *not* a Boolean value, so it
oughtn't be stored in a Boolean field.
I would never represent something that is neutral by using a
Boolean.


What's neutral in this case?


Sex. Male is neither better nor worse than female. Maleness is not a
negation of femaleness.
Second, in cases where the value is unknown, there is no way to
store that using a Boolean field.


Unknown, I can understand; neutral, I can't, without explanation.


There's an unintended implied value judgement in making one of them
TRUE and one FALSE, seems to me, and it would be better to avoid
such assumptions.


David,
I think you are making a mountain over a mole hill.
In my reply to the OP I specifically wrote:
and have it's Format property set to: ;"Male";"Female"

**assuming Male is the checked value.**

There is no implied judgment of True being better than False.

I could just as well have assumed Female was the checked value and
re-written the Format, or made no assumption at all and let the OP
figure it out for himself, which he may or may not have done.

If a value judgment were to be made regarding True and False, one
could say that True (value of -1) is less valued than False (value of
0). Does that make you feel any better? Or worse? It shouldn't.

His post referred to Male or Female. It did not refer to Male, Female,
Undecided, or Both. If he had, I would not have suggested the check
box as it would not have applied.

Let's keep this thread on the subject of what would work for the
poster, not what may or may not be politically correct from your view
point (or from mine).

And yes, I could just as easily have expanded my reply to include an
option group and a combo box as other possible controls to use.

Best wishes for the New Year.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jan 1 '06 #18
rkc
fredg wrote:
And yes, I could just as easily have expanded my reply to include an
option group and a combo box as other possible controls to use.


I favour the King Kong and (I'm gonna go with Fay Wray) images approach
myself.
Jan 1 '06 #19
David W. Fenton wrote:
I would never represent something that is neutral by using a
Boolean.


Nor I. It's simply unbelieveable how people looking through your data
structure can get bent out of shape over stuff that you had no intention
of implying. To avoid that in this case, I'd take my "Oracle" approach.

Oracle does not have yes/no data types. If I want a yes/no field, I
specify a text field with a length of 1 or 3 (varchar2(1) or
varchar2(3)) and impose a column level check constraint that limits
allowable values to only 'Y' and 'N' (or 'YES' and 'NO'). SO you can
see where this is going.

In Jet, what I've done in the past is set up a similar constraint by
setting a text field length to 1 and setting the validation rule to:

="M" Or "F"

With a validation text of:

The only permissable values are F(emale) or M(ale).

And there ya go.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Jan 1 '06 #20
fredg <fg******@example.invalid> wrote in
news:1h*******************************@40tude.net:
Let's keep this thread on the subject of what would work for the
poster, not what may or may not be politically correct from your
view point (or from mine).


My opinion is that your suggestion was logically incorrect and
politically problematic.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 1 '06 #21

I'm sure you got your answer by now so I won't weigh in on that. I'm
just a little sadder in seeing the nomenclature you use. Misuse of
language is a classic sign of disrespect for it. Disrespect for
language is a classic sign of cultural decay. Why did you not just
call the object "Sex"? Sex is easier to read, say and type than
Gender. People don't have gender. Only words have gender. If you
refer to the male or female property of a human, you are referring to
sex, not gender.
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","Female")

'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

Jan 2 '06 #22
A champion of Fowler's (Modern) English Usage is a joy forever.

Jan 2 '06 #23

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.