Using forms to save different values

G

Guest

Hi everyone. I’m new to Access and need a little help figuring something out.
We're working on a database to collect client info, and our grantors have
given us the field specifications to upload to them. And example of this is:

Field Values
MaritalStat 1-Never Married
2-Currently Married
3-Divorced

I’d like to build a form that allows people to select a person’s status, but
have the number posted to the table (e.g. user selects “Divorced†but the
value “3†is what’s posted to the table). Is it possible to do something like
this?
 
J

Jeff Boyce

Use two fields in a MaritalStatusLookupTable (? tlkpMaritalStatus):
StatusID
StatusTitle

Put the 1, 2, 3 in the first field.

Put the "Never Married", ... in the second field.

Use a combo box that returns both fields, but "hides" the first one (width =
0). This will display the text in the combo box on the form, but store the
1, 2, 3...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Douglas J. Steele

Combo boxes let you have multiple columns in them.

If you store values in a MaritalStat table with 2 fields (let's call them
MaritalStatId and MaritalStatDs), you can set the RowSource for the combo
box to

SELECT MaritalStatId, MaritalStatDs FROM MaritalStat ORDER BY MaritalStatId

Set the combo box as having 2 columns, with the 1st column as the bound
column. Set the ColumnWidths property to 0"

You'll now see only the description in the combo box, but the underlying
field in the recordsource will store the number.
 
G

Guest

This is an excellent candidate for an option group. You can use toggle
buttons, option buttons, or check boxes... which ever suits you best. Each
option control witihin an option group will return an integer (long) value
through the option group.
Lets say you have an option group named opgMaritalStatus. You would bind
the Marital Status field in the form's recordset to the control
opgMaritalStatus. Now, which ever of the options buttons is selected will
determine the value loaded into record source field.
The option group will have the value of the Option Value property of the
selected button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top