Option groups, passing a string value to table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I have a form with a group of three option buttons. Everything is working
fine and "as expected" but I want to change the value inserted into the
table. Currently, the option group places an integer value, 1 through 3, in
the table but I want to change the value to a string. For example, instead of
"1" I would like the string "State" placed into the table.

Thanks,
Scott
 
Why? It's generally better to have numeric foreign keys in your table.

Assuming you have a table that translates the numbers to their values, join
the two tables in a query and use the query wherever you would otherwise
have used the table.
 
This needs to be kept as simple for usability, reliability, maintenance and,
in this case, I don't see any benefit to using a table linked to another
table.
Scott
 
Hi All,

I have a form with a group of three option buttons. Everything is working
fine and "as expected" but I want to change the value inserted into the
table. Currently, the option group places an integer value, 1 through 3, in
the table but I want to change the value to a string. For example, instead of
"1" I would like the string "State" placed into the table.

Thanks,
Scott

Simpler to just store the number value.
Then whenever you wish to show the text equivalent, use an unbound
control (assuming you are using sequential values 1,2,3 etc.):
=Choose([TableFieldName],"State","NextText","ThirdText")
 
Sorry, but that is the recommended approach with Relational databases.

Certainly, having the words there doesn't improve maintenance: if you've
currently got A, B and C as your text, and decide you want Best, Better,
Good instead, all you have to do is change your lookup table, not every row
in your main table.

There's no difference in usability, either: as I said, you can create a
query and use the query rather than the table (seldom, if ever, should you
be working directly with the table anyhow)

I don't see how reliability enters into the equation.

However, in the end, it's your database.
 
I'm using an option group for the first time and am looking through some old
postings for help.

I have a male/female check box, so the entries in my table are "1" for male,
and "2" for female.

My first question is - how can I change that? Let's say I want to change
the value from a "2" to a "0" for females.

Also, it looks like I need a unbound control (?) to show the text data
(male) on my report instead of the numeric data (1) on my report???

Thanks,
Tina



fredg said:
Hi All,

I have a form with a group of three option buttons. Everything is working
fine and "as expected" but I want to change the value inserted into the
table. Currently, the option group places an integer value, 1 through 3, in
the table but I want to change the value to a string. For example, instead of
"1" I would like the string "State" placed into the table.

Thanks,
Scott

Simpler to just store the number value.
Then whenever you wish to show the text equivalent, use an unbound
control (assuming you are using sequential values 1,2,3 etc.):
=Choose([TableFieldName],"State","NextText","ThirdText")
 
Back
Top