By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,880 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,880 IT Pros & Developers. It's quick & easy.

Trougble with Combo Box

P: 48
Hello,

I have a form that I would like to auto-populate text boxes in based on the selection made from a combo box. I have set the form record source to a table "SubmittedTo" which contains 3 fields (4 including the ID). The fields are Name, Website and Type. I want to select the Name from a combo box and have the website and type text boxes populate with the corresponding information.

I have tried creating the combo box from the tools menu but I have run into problems with it either not allowing me to actually select an item form the list or when I do select one and then go back to design it is overwriting the 1st record.

I have also tried creating it first as a text box form the field list for the form, then changing it to a combo box. The text boxes are also created from the same field list. Once I change the Name text box to a combo box it displays only the first record. When I leave it as a text box I am able to scroll through the records and all the fields change properly.

Any help you can provide would be greatly appreciated. I feel like I am spinning my wheels and I have not been able to find any documentation to assist with this particular problem. Incidentally I am far removed from coding (and that was in Perl) so I am a bit behind the curve on manually entering code.

Thanks,
Doug
Feb 5 '08 #1
Share this Question
Share on Google+
6 Replies


ADezii
Expert 5K+
P: 8,637
Hello,

I have a form that I would like to auto-populate text boxes in based on the selection made from a combo box. I have set the form record source to a table "SubmittedTo" which contains 3 fields (4 including the ID). The fields are Name, Website and Type. I want to select the Name from a combo box and have the website and type text boxes populate with the corresponding information.

I have tried creating the combo box from the tools menu but I have run into problems with it either not allowing me to actually select an item form the list or when I do select one and then go back to design it is overwriting the 1st record.

I have also tried creating it first as a text box form the field list for the form, then changing it to a combo box. The text boxes are also created from the same field list. Once I change the Name text box to a combo box it displays only the first record. When I leave it as a text box I am able to scroll through the records and all the fields change properly.

Any help you can provide would be greatly appreciated. I feel like I am spinning my wheels and I have not been able to find any documentation to assist with this particular problem. Incidentally I am far removed from coding (and that was in Perl) so I am a bit behind the curve on manually entering code.

Thanks,
Doug
We'll take it from scratch and see what happens. Assuming your Table looks like:
Expand|Select|Wrap|Line Numbers
  1. ID    Name       Website    Type
  2. 1    One      123         A
  3. 2    Two      456         B
  4. 3    Three      789           C
  1. Create a Combo Box on your Form and Name it cboSubmitted
  2. Select Properties ==> Data Tab
    1. Row Source Type = Table/Query
    2. Row Source = SubmittedTo
    3. Bound Column = 1
  3. On the Format Tab
    1. Column Count = 4
    2. Column Widths = 0;1;1;1 'can readjust if necessary
  4. Create 3 Text Boxes on your Form and Name them: txtName, txtWebsite, and txtType
  5. In the AfterUpdate() Event of the Combo Box, place the following code:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub cboSubmitted_AfterUpdate()
    2.   Me![txtName] = Me![cboSubmitted].Column(1)
    3.   Me![txtWebsite] = Me![cboSubmitted].Column(2)
    4.   Me![txtType] = Me![cboSubmitted].Column(3)
    5. End Sub
  6. Any problems, let us know
Feb 5 '08 #2

P: 48
Thank you very much, I will give that a try and let you know if it worked.

Doug
Feb 5 '08 #3

P: 48
That worked perfectly. Thank you again....
Feb 5 '08 #4

ADezii
Expert 5K+
P: 8,637
That worked perfectly. Thank you again....
You are quite welcome.
Feb 5 '08 #5

P: 2
Hi, I am having similar issues like the user before; I have tried your solutions but i must be doing something wrong as it is not working.
I am on a beginner level with access; can someone please guide me through?

I am filling in a "Purchases" table via a "Purchases" form. In the form, I have a combo box which selects the "Supplier Name". I want another corresponding text box to be populated with the supplier Id (Both supplier name and ID comes from the supplier table), which then gets transferred onto the Purchases table.

Can someone please guide me; I have spent over 1 day wrecking my brains, trying all different codes. I must be doing something wrong that a simple thing like this is not working.
Feb 27 '08 #6

ADezii
Expert 5K+
P: 8,637
Hi, I am having similar issues like the user before; I have tried your solutions but i must be doing something wrong as it is not working.
I am on a beginner level with access; can someone please guide me through?

I am filling in a "Purchases" table via a "Purchases" form. In the form, I have a combo box which selects the "Supplier Name". I want another corresponding text box to be populated with the supplier Id (Both supplier name and ID comes from the supplier table), which then gets transferred onto the Purchases table.

Can someone please guide me; I have spent over 1 day wrecking my brains, trying all different codes. I must be doing something wrong that a simple thing like this is not working.
sriya000, I realize that you are new, but cutting into someone else's Thread in this manner is not an acceptable practice. Kindly create a New Thread with an appropriate Title, post all the relevant information with particular attention to details, and I'm sure one of us will get back to you in a timely fashion. Thank you.
Feb 27 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.