Filling a textbox with a table's name field knowing the IDNum field

  • Thread starter John S. Ford, MD
  • Start date
J

John S. Ford, MD

I'm passing a number from one form to another via the OpenArgs property.
This number is the primary key for a table, tblTeams (field name TeamIDNum).

How do I use this number to populate a TextBox with TeamName given the
TeamIDNum? I know how to do this with a ComboBox by setting its datasource,
BoundColumn property and field widths and then feeding it the TeamIDNum.

What is the analogous technique for doing this with a TextBox?

Thanks,
John
-------------------------------------------------------
John S. Ford, MD, MPH
Assistant Professor of Medicine
David Geffen School of Medicine at UCLA
Harbor-UCLA Medical Center
(e-mail address removed)
http://califmedicineman.blogspot.com
 
S

Stuart McCall

John S. Ford said:
I'm passing a number from one form to another via the OpenArgs property.
This number is the primary key for a table, tblTeams (field name
TeamIDNum).

How do I use this number to populate a TextBox with TeamName given the
TeamIDNum? I know how to do this with a ComboBox by setting its
datasource, BoundColumn property and field widths and then feeding it the
TeamIDNum.

What is the analogous technique for doing this with a TextBox?

Thanks,
John
-------------------------------------------------------
John S. Ford, MD, MPH
Assistant Professor of Medicine
David Geffen School of Medicine at UCLA
Harbor-UCLA Medical Center
(e-mail address removed)
http://califmedicineman.blogspot.com

Well one way would be to use the Dlookup function. Set the TextBox's
ControlSource property to:

=Dlookup("TeamName", "tblTeams", "TeamIDNum=" & Me.OpenArgs)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top