If [PEN] is a field in the form's record source, you don't need to reference
the table. Also, column references in combo boxes are numbered from 0, so
the second column is 1. To add some detail to Wayne's posting, click the
three dots in the combo box property sheet and build a query based on [WPS
Data]. Include [WPS] and [MIN PEN]. Set the combo box column count to 2,
its bound column to 1, and its column widths to 1.5";0". You could also
build a named query of the same design, and use that as the row source. In
either case, set the control source of an unbound text box to:
=IIf([cboComboName].[Column](1) > [PEN],1,0)
This compares the field [PEN] in your form's record source with the second
column ([MIN PEN]) of the combo box row source, returning 1 or 0 as the case
may be.
Wayne-I-M said:
Bruce would have (may already have) told you this but you need to bring
the
Min Pen into the combo box. Set the coloums to 2 and use WPS and col 1
and
Min Pen as col 2.
Your formula should be
=IIf(([ComboName].[Column] 2)>[WPS Data]![PEN],1,0)
zachnjoe said:
Here's a shortened version of my table called [WPS Data]. [WPS] is
selected
in a combo box on the form. I need to use the [MIN PEN] value associated
with the selected [WPS].
WPS MIN PEN MAX PEN
1A1457-LBW2A 0.01 0.03
1A6405-LBW1A 0.02 0.04
1A6405-LBW1B 0.01 0.03
1A6405-LBW1C 0.01 0.03
1A6405-LBW1D 0.01 0.02
BruceM said:
I have overlooked something. Which record from [WPS Data] do you want
to
view? Can you add the [WPS Data] table to a record source query for
your
form? You need to reference the field, but you also need to specify a
record. What is [MIN PEN]? Describe in plain English,what you are
trying
to do.
I tried it with and without [Tables] and I'm still getting the same
error.
The table [WPS Data] has multiple columns. The first column is
[WPS]. Do
I
need to reference [WPS] somehow so the control knows which row to
pull the
[MIN PEN] value from?
:
Did you try adding [Tables] in front of [WPS Data] as I suggested?
I changed the name of the field from [MIN] to [MIN PEN].
=IIf([PEN]>[WPS Data]![MIN PEN],1,0). The table [WPS Data] is not
part
of
the form's record source so I have to call it out. I'm still
getting
the
error.
:
Another possibility besides what Wayne has mentioned: do
controls and
fields have the same name? Also, what is WPS Data? If it is
part of
the
form's record source you do not need to specify the table (or
whatever
it
is). If it is not part of the form's record source then I
believe you
need
to do something like:
[Tables]![WPS Data]![FieldName]
I have a control source in a text box. I've narrowed down the
problem
being
with the number, [MIN], I'm trying to pull and use from table
[WPS
Data].
=IIf([PEN]>[WPS Data]![MIN],1,0)