Solved

Text value for option group

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

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

Suggested Solutions

Title # Comments Views Activity
Programmer 14 48
Macro to import XML in Access 2013 2 37
is Microsoft Access going to Die? 9 47
Field naming convntions - MS Access 7 27
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

770 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