Solved

Text value for option group

Posted on 2003-12-08
4
248 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

830 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