In a form in Access 2000 how do I relate the value of 1 field to .

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box that queries a small list so I can pick a name. If I pick
a name for this field I would like various fields on this form to return a
value that is specific to that name. I have tried using an expression with
the IIF statement and put it in various places default, macro, event etc.
Example: =IIf("name"=Lake Grove,80,0) or =IIF([name]="LAKE GROVE",80,0) OR
=IIF([name]="LAKE GROVE",80,=IIF([name]="LAKEVIEW",120,0)) you can see where
Im going with this. In the macro I tried to use in a setvalue on and I get
parsing errors. In default it will except but nothing happens when I change
names. I have 4 names to chose from so each of specific fields could have 4
different values to display. Please help
 
Depends a bit on what you do with the nam,es. If they are read only, the
simplest way is to have a multi-column combo, but hide columns 2,3 and 4.

The control source of the text boxes then becomes

=MyCombo.Column(2)
 
Hi,

Something like this might get you started:
Your list of four names: put them in a table with two fields, one will be
the locationName, the
other will be the value you want associated with that name e.g.

tblCboLocation Name ReturnValue
Lake Grove 80
Lakeview 120
Lake Blue 160
Lake Red 200


For the combobox Row Source: SELECT [tblCboLocation].[Name],
[tblCboLocation].[ReturnValue] FROM [tblCboLocation]

Two columns and the bound column = 2, ie. the combo will return
the 'ReturnValue' data above. If you set the column widths to e.g. 1";0"
then the second column with
the value you want will not be displayed.

I put a textbox on the form with the Control Source = [cboLocation] and the
value it displayed
was the number in the ReturnValue column above ie. the second hidden column
in the combobox.

HTH -Linda
 
Back
Top