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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Text Box From Combo box returns error #Name?

Status
Not open for further replies.

appelq

IS-IT--Management
Dec 28, 2004
72
US
I have a table - tblCustomers with CustID and CustName

On a Form I put a 2 column combo Box - cboCustID and it works fine.
The Drop down is set to show both columns from the table.

I have an Unbound Text Box - txtCustName I want to populate from the 2nd value in the combo box.
In the Properties, Control Source I have: = [cboCustID].[Column](1)

But when I select a value in the combo box, the Text box just shows #Name?

I'm running MS Access 2010

thanks,
Chuck
 
The Row source for cboCustID is:
SELECT tblCustomers.CustID, tblCustomers.CustName FROM tblCustomers ORDER BY tblCustomers.[CustName];

Bound column = 1
Column count = 2

Chuck
 
Also - Control Source = CustID
I believe that is saying that I want to save the Column(0) value to that field on the Table that this form is designed to update.
 
You are correct about saving the CustID field value from tblCustomers in the CustID field of the Record Source of your form.

Just for troubleshooting purposes, try change the name of txtCustName to txtCustomerName.

Duane
Hook'D on Access
MS Access MVP
 
OK. I renamed it but still no joy.

txtCustomerName
 
No joy. Odd.

I did exactly as you suggested.
I created a form with "Form design", and did not bind it to a Control source.

I then added a combo Box cbo_CustID pointing at tblCustomers and with 2 columns CustID and CustName
The Combo box work fine.

I then added an unbound Text Box [Text2] and set the control Source for that to:
=[cbo_CustID].[column](1)

The text box shows #Name? just like the other.

Could I have a bad DLL or something?
 
I'm surprised this doesn't work. Have you attempted to compile all the code in your application? Have you unchecke all the Name Autocorrect boxes in the Options?

Have you tried something similar in a new database file with only the customers table or linked to it?

Duane
Hook'D on Access
MS Access MVP
 
Huh. I created a new database [TEST]
I added one new table [tblCustomers]
I created the unbound form the same way, and it worked.

Back in the original database, I've tried the same technique on another Form and it also fails.

So I tried a Compact and Repair on the original database but it did not help.

I don't want to rebuild the entire database, but I will try Importing the Form into a test database and see if that fixes my form.

Unless you have any other thoughts?

I appreciate your help!

thanks,
Chuck
 
Followup -
I imported the Form and tables from the original Database, the form works fine in the text database.

 
You didn't respond to two of my earlier questions:
Code:
Have you attempted to compile all the code in your application? Have you unchecked all the Name Autocorrect boxes in the Options?


Duane
Hook'D on Access
MS Access MVP
 
No I didn't do those steps.
What I did was to create a blank database with a new name and I imported all of the objects from the original database and it all seems to work OK now.

Thanks for your help!

Chuck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top