Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"Because of this forum, I continue to WOW! my clients!"

Geography

Where in the world do Tek-Tips members come from?

Access form with combo box and text boxes

ronwmon (Programmer)
8 Jun 12 16:30
I am very new to Access forms. Hopefully I can find a little help.

First, I would like to find some good forms training leads. If you know where I might find good forms training please share it with me.

I am working on a form where I want a combo box to allow me to select a client and then have rhe form populated with the client information. Further I plwn to put buttons on the form that will take me to other forms where I can edit the data displayed on the initial form or where I can enter data for a new client.

I have a table titled "Companies" that has the data on each client. I have a field titled "Company Name" as well as several others.

I have a combo box that displays the company name when clicked. This works. I have a query titled "QryComSelect" that has all of the fields in the "Company Name" table. The "Company Name" field of the query is populated by the combo box and when a choice is made with the combo box the query shows the entire record of that company.

I have a text box with the following in the control source:

=DLookUp("[companies]","[qrycomselect]" & [Forms]![frmcompanyview]![combo2])

This text box simply says "#Error".

I need to put several text boxes on the form, each pointing to a field in the table or query to show the information contained.

I appreciate any help you may be able to provide.

Later,

Ron--
dhookom (Programmer)
8 Jun 12 19:20
If you have a combo box on a form based on the Company Name table, you can add text boxes with control sources like:

CODE --> expression

=cboYourComboBox.Column(x)
The x is the column number from the combo box where the first column is numbered 0.

Duane
Hook'D on Access
MS Access MVP

ronwmon (Programmer)
11 Jun 12 11:12
I tried your suggestion.

My combo box is combo2. The query the combo box refferences has just 2 columns, the first is the company name.

I entered =cbocombo2.column(0)

Access changes the line to be =[cbocombo2].[column](0)

I still have #Name? in the text box.

Any other suggestions?
dhookom (Programmer)
11 Jun 12 14:53
I don't approve of your combo box name or how you mis-used it in the expression. Your control source should be:

CODE --> controlsource

=[combo2].[column](0)
Better yet, change the name of the combo box to cboCompany or similar:

CODE --> controlsource

=[cboCompany].[column](0)

Duane
Hook'D on Access
MS Access MVP

ronwmon (Programmer)
11 Jun 12 15:23
Sorry, I didn't realize your cboCompany was the name of the combo box. I don't have much experience working with forms. Your name makes perfect sense and I changed my combo box name to cboCompany.

Your code works great and is quite simple.

Do you have any suggestions on a good online tutorial for learning forms?

Thanks ver much for your response.

Ron--
dhookom (Programmer)
11 Jun 12 16:44
I suggest Crystal's Access Basics for all new users.

Duane
Hook'D on Access
MS Access MVP

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close