Solved

Text value for option group

Posted on 2003-12-08
4
246 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
  • 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now