Populate a field based on another

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I have a form developed in which I want the user to select
a chemical name and to automatically get the associated id
# for the chemical. I have tried to use dlookup for the
id# field, but can't seem to get it to work. I set the
control source for the id# to the following.

=DLookUp("[cas_number/ID]","rt_param_name","[param_name]=
[Combo95] ")

Any suggestions.

TIA,
Eric
 
To carry on the DlookUp route, try
=DLookUp("[cas_number/ID]","rt_param_name","[param_name]=
'" & [Combo95] & "'")
However, you could change the combo's RowSourceSQL to bring
the id into a second column e.g.

SELECT nameColumn, idColumn FROM chemicalTable

Then by changing the ColumnCount to 2, you set the text box
in the comboBox's AfterUpdate event handler e.g.
idTextbox.Value = combo95.Column(1)

You will have to change nameColumn, idColumn,
chemicalTable, idTextbox to suit your app.

Hope This Helps
Gerald Stanley MCSD
 
Back
Top