Get Company Name from Company ID?

  • Thread starter Thread starter Oli
  • Start date Start date
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
 
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]
 
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 & """")
 

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

Back
Top