Access Newbie Question: Auto populate text box based combo box not working (1 Viewer)

jlowder

New member
Local time
Today, 03:42
Joined
Jul 6, 2018
Messages
6
I am trying to populate multiple text boxes from combo box. I had it working for a while and now it has mysteriously stopped working. I cannot figure out what, if anything, I changed.

The Combo Box has a row source which selects all 7 columns of the relevant table. When I click on the combo box, I can see all 7 columns in the drop-down list. But after selecting a value, none of the text boxes display the correct value.

The intent is for the Combo Box to display the first column, and then the following 6 text boxes to display the other 6 columns. The Control Source for the 6 text boxes look like this:

=[Combo471].[Column](1)
=[Combo471].[Column](2)
=[Combo471].[Column](3)
=[Combo471].[Column](4)
=[Combo471].[Column](5)
=[Combo471].[Column](6)

What I see in all of the text boxes, however, is "#Name?". I'm assuming I'm making a simple (and stupid) Access novice mistake. What is it?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:42
Joined
Aug 30, 2003
Messages
36,125
Make sure the column count property of the combo is 7, and the column widths are set appropriately (0 if you want hidden).

I'd recommend a more descriptive combo name.
 

jlowder

New member
Local time
Today, 03:42
Joined
Jul 6, 2018
Messages
6
Hi Paul,

Thanks for the super quick reply. Point taken on the combo name.

Here is what I have:
Column Count: 7
Column Widths: 1"; 2"; 2"; 1"; 1.5"; 1"; 1"
Column Heads: Yes
List Rows: Yes
List Width: 10.5"

But no luck getting the text boxes on the form, below the combo box, to display anything other than "#Name?"
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:42
Joined
Aug 30, 2003
Messages
36,125
Did you change the combo's name by chance? Is it on the same form as the textboxes?
 

jlowder

New member
Local time
Today, 03:42
Joined
Jul 6, 2018
Messages
6
Hi Paul,

Good question. I had not changed the name when the problem started. But after your suggestion to create a more descriptive combo box name, I did exactly that. But then I discovered a typo. I had somehow removed all of the square brackets around the word "Column." Restoring the square brackets around "Column" fixed part of the problem.

So I now have:

A table called "tblMetric" and a corresponding form called "frmMetric." That form, in turn, has a combo box with the name "cbRequirement"

followed by 6 text boxes with a Control Source expression which looks like this:

=[cbRequirement].[Column](1)
=[cbRequirement].[Column](2)
=[cbRequirement].[Column](3)
=[cbRequirement].[Column](4)
=[cbRequirement].[Column](5)
=[cbRequirement].[Column](6)

When I open the form which contains this combo box, the combo box and related text boxes are all blank, despite the fact that I had previously set the value for the combo box. When I select a value from the drop-down in the combox box and then try to save the record, I now get the following error message:

"You cannot add or change a record because a related re3cord is required in [tblRequirement]." When I view table [tblRequirement] in Datasheet view, it displays the linkage between the record in [tblRequirement] and the record in [tblMetric].

Any suggestions?

Jeff
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:42
Joined
Aug 30, 2003
Messages
36,125
If it's coming up blank, it either isn't bound, or given the error, the form is coming up on a new record. The error would imply you're trying to put a value in that isn't in the requirements table. Can you attach the db here?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:42
Joined
Aug 30, 2003
Messages
36,125
The bound column property should be 1, not 0. Don't ask me why, but some properties like column are 0 based and some like the bound column are not.
 

jlowder

New member
Local time
Today, 03:42
Joined
Jul 6, 2018
Messages
6
I changed the bound column property from 0 to 1. I can now save the record, but now all of the linked text boxes no longer work. :(
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:42
Joined
Aug 30, 2003
Messages
36,125
Did you get this sorted out? The textboxes are updating for me. I can send the file back if you want, but I don't recall changing anything but the bound column. I am getting old and senile though. ;)
 

jlowder

New member
Local time
Today, 03:42
Joined
Jul 6, 2018
Messages
6
Not consistently. Sometimes the database works and sometimes it doesn't. I cannot figure out the pattern. I had it working, but then after rebooting the problem started again. I don't get it.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:42
Joined
Aug 30, 2003
Messages
36,125
Regarding your email with the file (technical discussion should stay on the forum, so others may benefit from or contribute to the solution):

"Something weird is going on. I made literally no changes at all to the database. I then played around with "Database Tools" by selecting "Analyze Performance" and then selecting all and then OK. It closed frmMetric and gave me 2 suggestions. I then closed that window and re-opened frmMetric. When I did, all of the fields on the Requirement tab displayed correctly."

The db you sent me works fine for me. I suppose it's possible something is corrupted. You can try importing all objects into a new database, and SaveAsText. Those and other thoughts here:

http://allenbrowne.com/ser-47.html
 

irsmalik

Registered User.
Local time
Today, 14:42
Joined
Jan 28, 2015
Messages
88
Hi friends….. I am making a DB and I want to select Territory from Region Table + Company Table. now I am making Mistake at some point and I need your help. Here is the structure.

Table Company
CompanyID Number
CompanyName Text

Table Region
RegionID Number
RegonName Text
CompID Number
CompName Text

Table Territory
TerritoryID Number
TerritoryName Text
CompID Number
RegID Number

Form Name: Form1 with 2 Combo Box and one List Box

I want to select Company (from 2 Companies)
I want to select Region Associated with Company (from 29 Regions)
I want to select Territory Associated with Region (from 180 Territorities)

Kindly guide me how to do it.

Thanks
Irsmalik
 

Users who are viewing this thread

Top Bottom