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 field by selecting option in listbox

Status
Not open for further replies.

craigey

Technical User
Apr 18, 2002
510
GB
Hi all,

I'm trying to get field to automatically fill in one of 5 options, depending upon which option is chosen in the previous field.

Basically I have 2 fields one called fullrank, the other called rnk.

The fullrank is a listbox with 3 options. rnk also has 3 options and is currently a listbox.


fullrank rnk
options Adult Warrant Officer AWO
Flying Officer Flg/Off
Pilot Officer Plt/Off


how can i get the rnk field to change to AWO if adult warrant officer is chosen? etc

Please take it step by step, i'm an access newbie.

Thanks

 
Hi

So you have a 'key' of AWO and a 'description' of Adult Warrant Officer

You want the user to choose from a lsit which shows Adult Warrent Officer, but you want to store AWO in the table

Right?

You make a combo box with two columns, based on the list of ranks.

First Column one the 'key' value, second column is the description.

You make the width of the first, 0, so user does not see it.

You make the bound column, the first column, so that is what gets stored in the table.

Be aware, than column numbers are counted as 0, 1, 2 etc

Good luck Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 

You want the user to choose from a lsit which shows Adult Warrent Officer, but you want to store AWO in the table

Right?

almost, but not quite though!

I want the user to choose the 'description' (adult warrant officer) and both the 'key' and the 'description' to show up in the table. The key will be automatically filled in when the description is filled in. The key will be a locked field so the user cannot change it, (unless they choose a different option for the description listbox. Which would then automatically update the key)

I do see what you are trying to tell me, but i would prefer both the 'key' and the 'description' to be shown in the database as 2 seperate, but linked fields.


Thanks for all your help!
 
Hi

First point is don't do it, you are storing unnecessary data and thus breaking the rules of normalisation.

But if you insist, then do as I said in the first post, but also

Have a control on your form, bound to the 'description'.

In the after update event of the combo box, put txtDescription = cboRank.column(1)

using your own variable names of course

OK? Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Um. I almost had it yesterday, and I gave up!

Basically only some of the fields were updating the short rnk field, when the fullrank options were chosen. After a good nights sleep, I gave it another go, only to find my floppy disk is knackered!

I've tried several times to get this to work, but I'm making a right mess of it. I've decided to leave it out of the database. I didn't really need it, I was just interested in trying to get it to work.

Thanks Anyways!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top