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

Autofill Text Boxes through List or Combo box HELP

P: 1
Hi there, i'm quite a newbie at Access and i am currently stuck on a form problem. I am using a wizard of oz-style database and I want to autofill boxes through the selection in a combo box

I already have fields in my database including charactersname, characters gender, characteridnumber etc.. and i want to include the charactersname in the combo box, so that when selecting a name, the appropriate gender is also shown below that

In other words, if Dorothy was on the selection list/box, when selected, the gender field at the side would automatically turn to "Female", same goes for Tinman and Scarecrow being "Male"

Thank you very much :-)
May 8 '14 #1
Share this Question
Share on Google+
5 Replies


Expert 100+
P: 1,240
sonickidj,
Welcome to Bytes.com.

Perhaps the easiest way to accomplish this is to make the rowsource of your combo box have multiple columns. You can make the display length of the "extra" columns zero so they won't show in the drop-down but the data will be along for the ride.

In the AfterUpdate event of the combo-box you can fill text boxes on the screen by referencing columns of the comobo box. Something like this:
Expand|Select|Wrap|Line Numbers
  1. me.Gender_txt = me.Character_cbo.Column(1)
  2. me.Age_txt = me.Character_cbo.Column(2) 
etc... Note that the first column of a combo-box is column(0).

There are other ways to accomplish what you want but this may be the simplest. You'll find the relevant settings in the Data tab and the Format tab of the combo-box properties.

Jim
May 8 '14 #2

Expert 100+
P: 1,240
For my example to work, the Select query of the combo-box rowsource would have to include Gender and Age as the 2nd and 3rd fields selected. You have complete control over that when you build the query for the rowsource.

Jim
May 8 '14 #3

twinnyfo
Expert Mod 2.5K+
P: 3,482
Jim,

Just reviewing some of these old posts, and you taught me something today! I never realized you could read the values of the various columns of the Combo Box. I thought the Value was simply the default Column.

This gives me som ideas on how to use this new knowledge! Thanks for your post and sharing with us!
Jun 10 '14 #4

Expert 100+
P: 1,240
So glad to post something helpful once in a while :) The combo box really is a flexible, useful object.

I've gained a strong appreciation for list boxes in recent years. I used to avoid them but now I find 101 uses for them. I've gotten more selective about when I use combo boxes.

Jim
Jun 10 '14 #5

twinnyfo
Expert Mod 2.5K+
P: 3,482
I know this may be a bit off topic from the OP, but what advantages have you found for using a list box over a combo box? I like how compact a combo box is compared to a list box--although acombo box requires two clicks instead of one in some cases. I'd be interested to know your thoughts. I am always eager to explore new/better ways of doing things.
Jun 11 '14 #6

Post your reply

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