Solved

Text value for option group

Posted on 2003-12-08
4
245 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now