?
Solved

Text value for option group

Posted on 2003-12-08
4
Medium Priority
?
251 Views
Last Modified: 2008-03-06
i'm making a "sex" option group.. options are of course Male and Female... i already have data in the table which someone else made and i am fixing.  in the field sex, values are saved as 'M' and 'F'.  the option group wizard will only let me save the values to the tables as numbers and i want to save them as 1='M' and 2="F"...  i found this code that should work

=Switch([Forms]![frmPatient]!sex=1,"M",[Forms]![frmPatient]!sex=2,"F")

first of all, is that code correct, and second if so, where does it go?

Matt
0
Comment
Question by:matthackney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 32

Expert Comment

by:jadedata
ID: 9897387
Hey matthackney!

  Option groups can ONLY use numerics for base values.  Because this is so, you will constantly have to be changing the number to "M/F" values, back and forth ad nauseum in your code.  You would have to put your Switch() function conversion everywhere you need to translate the optgrp to a text value.

  Would you consider a combobox, in place of the option group??  No special coding required....

regards
Jack
0
 

Author Comment

by:matthackney
ID: 9897511
i've got a combo box now that works fine.. but the form in foxpro (i mentioned i am converting this from someone else's database) has buttons and i wanted it to look as much like that one as possible.. i was just seeing if there was a way.

Matt
0
 
LVL 32

Accepted Solution

by:
jadedata earned 400 total points
ID: 9897548
There is a way,... and you will be constantly trying to stay in front of the convertion from number to string.
Keep it simple.
0
 

Author Comment

by:matthackney
ID: 9897746
sounds like a good idea to me, it's what i wanted to do in the 1st place.. i'll check with the project leader, he'll live.
thanks,
matt
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question