Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access form with combo box and text boxes

Status
Not open for further replies.

ronwmon

Programmer
Jul 13, 2007
97
US
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--
 
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:
=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
 
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?
 
I don't approve of your combo box name or how you mis-used it in the expression. Your control source should be:
Code:
=[combo2].[column](0)
Better yet, change the name of the combo box to cboCompany or similar:
Code:
=[cboCompany].[column](0)


Duane
Hook'D on Access
MS Access MVP
 
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--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top