Alphabets / Words instead of Numerical Values for Data Input from Radio Buttons (1 Viewer)

Pinesh

New member
Local time
Today, 15:33
Joined
Jan 3, 2018
Messages
10
Hi

Re : MS Access 2013 Form - Radio Buttons - Gender Entry - M or F

I am not an expert with MS Access and hence posting a very basic question.
We are connected with education field and this doubt is worrying our students.
Unfortunately the school ICT teachers have neither attended to the doubt nor have solved it.

The students are asked to create Radio button in MS Access form for field 'Gender' where the data input is either 'M' or 'F'.

When we create radio buttons, it is allowing to enter values in the database table in numerical form only i.e. 1 for Male and 2 for Female.

Have the following doubts:-
(1) Can we enter thru the radio buttons - alphabets 'M' or 'F' in the database table instead of '1' or '2'? Does any such functionality exist in MS Access?

(2) If not and that only values can be entered i.e. '1' or '2'.... and at the same time the question paper also mentions that to have a validation rule in the field 'Gender' that data should only be either 'M' or 'F' .... then .... how are both above instruction possible in the same database for the same table?

(3) If the above is a conflict then is the only solution to change the Field data type as Number and instead of entering 'M' or 'F' - it should either '1' or '2' where '1' = Male etc?

Your guidance will be highly appreciated.

Thanks
Regards / Pinesh Mehta
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:03
Joined
May 7, 2009
Messages
19,231
You can convert the numeric result of the option group to string.
The trick is make the control Unbound.
Add the gender field to the form.
Add code to the optio group AfterUpdate event.

Private sub option0_AfterUpdate()
Me.gender=Choose(option0, "Male", "Female")
End sub
 

Pinesh

New member
Local time
Today, 15:33
Joined
Jan 3, 2018
Messages
10
Thanks for the reply.

This question and the details given are for students of grade 9 and 10 and they do not have coding or VBA etc.

So for them they have to use the basic functionality of MS Access and do this conversion from Values to a string. Is this possible?

Thanks again.
 

plog

Banishment Pending
Local time
Today, 05:03
Joined
May 11, 2011
Messages
11,638
I think this is a good lesson for you and them. How boolean values (only 2 possibilites) is ultimately stored is irrelevant. What is relevant is how data is retrieved.

They/you should make a query to return the value they want and work with the query, not the table. Suppose your table is named TABLE and the gender field is UserGender (and I will throw in some other fields as well to make it look good). This SQL which is very basic, will achieve what you want:

Code:
SELECT UserName, UserID, Iif(UserGender=1, "Male", "Female") AS GenderDescription
FROM TABLE

It's a simple IIf expression (https://www.techonthenet.com/access/functions/advanced/iif.php) and lets you convert your 2 values from numbers to text.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:03
Joined
May 7, 2009
Messages
19,231
You can just let the gender field as numeric and make comment that 1=male, 2=female.
 

Mark_

Longboard on the internet
Local time
Today, 03:03
Joined
Sep 12, 2017
Messages
2,111
Hi

Re : MS Access 2013 Form - Radio Buttons - Gender Entry - M or F

I am not an expert with MS Access and hence posting a very basic question.
We are connected with education field and this doubt is worrying our students.
Unfortunately the school ICT teachers have neither attended to the doubt nor have solved it.

This is poor design. I would stress this to your students. IF NO GENDER is provided, this forces you to enter data based on the users interpretation of who this is for. It is better to have an option for not known or not provided. Radio buttons do not do well for entering "Null" values. They should ONLY be used when you are assured there will be a value provided.

Let your students know this is similar to the question "Which is better to perform brain surgery, giant hammer or giant axe?" The proper answer would be "NEITHER".
 

Users who are viewing this thread

Top Bottom