Access 2016 - combo box

Jegajothy vythilingam
Jegajothy vythilingam used Ask the Experts™
i have a Form and on it  there is a combo box field.  The Form's table is tblCredit card
The data is picked from another table named tblCard Types.  Card types are like  Visa, MC, Amex and this table has only 2 fields, the ID field which is numeric and the card type field which is text.  Thus the data would be
1   Visa
2    MC
3    Amex

When I select the data from the combo box it is saved into a field in the tblCreditcard.  Although in the combo box I only have the field the Card type, thus allowing me only to select one of the 3 data  as above, but when after selecting I look at the table tblCreditCard, the data is entered as eg ; 1 and not Visa
Looks like I am doing something wrong but I do not what it is, hope the experts can please advise me.  thank u
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
if you want to save the text value, set the bound column of the combo box to 2
Note: the field card type must be set to text and not number
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010
actually, this is not normally considered "wrong", this is the behavior most database professionals would expect.  This results in smaller database files as it takes less drive space to store the value (1) than it does to store the text (Visa).  When viewing your data, I would recommend you create a query that links these two tables based upon the CardType field; That would allow you to view the name of the card type while still only storing the numeric value.  This would look something like:

SELECT myTable.ID, myTable.OrderName, myTable.CardType, tblCreditCard.Description
FROM myTable LEFT JOIN tblCreditCard on myTable.CardType = tblCreditCard.CardType

Use of the "LEFT JOIN" in this query ensures that all records from "myTable" would show up in the query results even if they do not have a value stored in the CardType column of the table.



I like Rey's solution, as in one stroke, it solved the issue.  Thank u

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial