Combo box

satkin2

New member
Local time
Today, 17:00
Joined
Aug 5, 2006
Messages
8
Hi,
Sorry if this is query is on here already, I've spent quite a while looking for a solution but couldn't find one.

I've got two tables,
tblCards
tblLocation

within the cards table I have a field for sold at, which i want to choose from the locations table.

I have inserted a combo box into my form which lists the locations and is bound to the sold at field, however it is giving the value of the location id, (the hidden key on the combo list) I would like to put the description of the location into the list instead.

Also, the cards table already has some entries in it, when I scroll through the entries, the combo doesn't show what the fields current value is when populated, how would I go about this?

Thanks

Steve Atkin
 
You need to set the number of columns in your combo box's properties to be 2 and the column width to 0";1.5" (if the id number is the first column, so it doesn't show the first one but shows just the name and then if the bound column is 1 it will store the ID while displaying the name).

Also, it sounds like your combo box is not bound to the field where you want it stored. Select the correct field from the drop down under Control Source.
 
Hi Bob,

I've checked the combo box and I think it is already set up as you said.

I've attached the file to hopefully give you a better insight.

What I am doing is having the list of all of the cards available, frmFilter. When one is sold I want to click on the Show button and open the edit form. Within this form I want to choose the location the card was sold at from the combo box and then close the form with the save. This will then put the sold at column on the filter page to the location in text, when I open the filter screen now, it gives the ID number.

NB: The text already in the sold at column was entered manually in before I began fitting forms etc to the database, this is because it is an evolving programme as requirements have changed.

Thanks

Steve
 

Attachments

Oops, I've solved my own problem.

I'd got bound column set to 1, it thought I'd checked this before but obviously not.

Thanks anyway.
 
Have a look at your attached database. The form frmCardsNEW will demonstrate how the combo boxes (Category and Location) should work on a form. You will see that the table CardsNEW only holds the ID number of the record. Now if you open the query QryViewData you will see that locaiton and Category are not displayed as numbers but as text, this is because of the the linking (relationship) of the tables.

Have a look at Relationships and also open the query in design view and have a close look at how it works.

I have also created a sample report called rptSchools which is based on a query called qrySchools, open it (the query) in design view and see how it is filtered.

You should never use "Name" to name a field in a table it is a reserved word in access, do a search on reserved words and you will find the complete list.
 

Attachments

That's great I understand the linking, I don't know why I didn't think of that before.

Cheers
 

Users who are viewing this thread

Back
Top Bottom