Form and IIF

  • Thread starter Thread starter Guest
  • Start date Start date
I have a field called Sample type (uses a lookup table) and about 10 fields
with different types of sample analyses. Depending on the Sample type I
would like a "Y" to appear under certain analyses. So if my sample type is
"E" then a "Y" appears under all the analyses. I can get that far with
=iif([Sample type]="E", "Y", "") in the control source of the analyte text
box.
My problem is then seeing the "Y" in the table. I can see all the other
data I enter on the form, but not the "Y"s. The other data is in the same
table as the analyses - which is the source table for the form.
 
Ok... Now we have something to go on. If you put your IIF statement in the
Control Source of a textbox, then that means the textbox is not bound to the
recordsource of your form, i.e. your table. Now, the question is whether or
not you REALLY need to store the "Y" values (or whatever values you need) in
your table. If you can get it to display on the form based on the [Sample
type] field, then there is no need to store it.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


andie said:
I have a field called Sample type (uses a lookup table) and about 10 fields
with different types of sample analyses. Depending on the Sample type I
would like a "Y" to appear under certain analyses. So if my sample type is
"E" then a "Y" appears under all the analyses. I can get that far with
=iif([Sample type]="E", "Y", "") in the control source of the analyte text
box.
My problem is then seeing the "Y" in the table. I can see all the other
data I enter on the form, but not the "Y"s. The other data is in the same
table as the analyses - which is the source table for the form.



Lynn Trapp said:
Wo! We need a ton more information. Where in your form are you using IIF?
What is the recordsource of your form? I'll think of some more questions
when you answer these.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


data
into
 
I do need to store it so I can use the "Y" values in later queries and also
to export.
Is there a different place for the IIF statement? Or can I make the textbox
bound AND with an IIF statement? Thank you.

Lynn Trapp said:
Ok... Now we have something to go on. If you put your IIF statement in the
Control Source of a textbox, then that means the textbox is not bound to the
recordsource of your form, i.e. your table. Now, the question is whether or
not you REALLY need to store the "Y" values (or whatever values you need) in
your table. If you can get it to display on the form based on the [Sample
type] field, then there is no need to store it.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


andie said:
I have a field called Sample type (uses a lookup table) and about 10 fields
with different types of sample analyses. Depending on the Sample type I
would like a "Y" to appear under certain analyses. So if my sample type is
"E" then a "Y" appears under all the analyses. I can get that far with
=iif([Sample type]="E", "Y", "") in the control source of the analyte text
box.
My problem is then seeing the "Y" in the table. I can see all the other
data I enter on the form, but not the "Y"s. The other data is in the same
table as the analyses - which is the source table for the form.



Lynn Trapp said:
Wo! We need a ton more information. Where in your form are you using IIF?
What is the recordsource of your form? I'll think of some more questions
when you answer these.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


using IIF in a form, how do I view result in my table I'm entering data
into
 
You can always recreate the same IIF statement in later queries and in
exports. If it works on the form it will work on those queries and exports,
if you export a query instead of a table. No, you cannot give a textbox 2
control sources. If you are determined that you need to store the value,
then you will need to use an IF statement in your form's code, probably in
the AfterUpdate event.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


andie said:
I do need to store it so I can use the "Y" values in later queries and also
to export.
Is there a different place for the IIF statement? Or can I make the textbox
bound AND with an IIF statement? Thank you.

Lynn Trapp said:
Ok... Now we have something to go on. If you put your IIF statement in the
Control Source of a textbox, then that means the textbox is not bound to the
recordsource of your form, i.e. your table. Now, the question is whether or
not you REALLY need to store the "Y" values (or whatever values you need) in
your table. If you can get it to display on the form based on the [Sample
type] field, then there is no need to store it.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


andie said:
I have a field called Sample type (uses a lookup table) and about 10 fields
with different types of sample analyses. Depending on the Sample type I
would like a "Y" to appear under certain analyses. So if my sample
type
is
"E" then a "Y" appears under all the analyses. I can get that far with
=iif([Sample type]="E", "Y", "") in the control source of the analyte text
box.
My problem is then seeing the "Y" in the table. I can see all the other
data I enter on the form, but not the "Y"s. The other data is in the same
table as the analyses - which is the source table for the form.



:

Wo! We need a ton more information. Where in your form are you using IIF?
What is the recordsource of your form? I'll think of some more questions
when you answer these.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


using IIF in a form, how do I view result in my table I'm entering data
into
 
Back
Top