Yes/No Trouble

D

Debbie

I would like my check box in a form for Male/Female to store either "M"
or "F" in the table instead of Yes/No. Is this possible?
 
A

Allen Browne

You could do that with a combo box.

A check box will always have the values -1 (true) or 0 (false). If you are
comfortable writing VBA code, you could be possible to program an unbound
check box to populate a field with M or F, depending in its value, using the
form's Current and Undo events to initialize the check box for the record.
 
A

Allen Browne

Use the Current event of the form to assign True or False to the check box,
depending on the value of the field.

Use the AfterUpdate event procedure of the unbound text box to assign "M" or
"F" to the field, depending on the check box's Value.

Use the Undo event of the form to assign True or False to the check box,
depending on the OldValue of the field.

This approach will not work in a continuous form or datasheet.
 
R

Rick Brandt

Debbie said:
Am I asking to much to give me a start with a VBA code?

No code necessary. In your table design change the display control from a
CheckBox to a TextBox and then set the format property to...

;"Male";"Female"

With a format sequence using three semi-colons as above you can specify any text
for a YesNo field.
 
D

Debbie

Thank you. It now works, I don't have check boxes but that is Okay.
Thank you, have a Merry Christmas!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top