Get Company Name from Company ID?

O

Oli

Hi

I know this is probably very easy but... I have a form that is not related
to a table.

This form is opened when a command button is clicked on another form and the
ClientID is passed forward as OpenArgs

I want to display the relevant Company Name associated with the ClientID in
a textbox.

Any ideas?
TIA
Oli
 
M

Mike Labosh

This form is opened when a command button is clicked on another form and
the ClientID is passed forward as OpenArgs

I want to display the relevant Company Name associated with the ClientID
in a textbox.

Me.RecordSource = _
"SELECT * " & _
"FROM [Your Company Table] " & _
"WHERE ClientID = " & YourOpenArgument

Me.Refresh

--
Peace & happy computing,

Mike Labosh, MCSD
"Working here is like living inside a Salvador Dali painting." -- Me. Yeah,
ME! [Oh fer cryin out loud]
 
L

Larry Linson

I am assuming there is a table named Companies, which contains the long
integer field ClientID and the text field Company Name and that you want to
display the Company Name field in the TextBox txtCompany. In the Current
event of the Form:

Dim strClientID as Long
Me!txtCompany = DLOOKUP ("CompanyName" , "Companies", "[ClientID]=" &
Me.OpenArgs & """")
 
Top