Yes/No

uplink600

Registered User.
Local time
Today, 13:50
Joined
Mar 18, 2004
Messages
69
I have two yes/no fields in my database and these are represented on a from by two check boxes. One field is called order won and the other is called order lost. I am going to add another field to the table called "status" and this will appear on the from as a label or text box. I would like the value in the status field for each record to be as follows.

If order won is checked (value = yes) then status = Won
If order lost is checked (value = yes) then status = Lost
If order lost & order won both unchecked (value = no) then status = Live

I was wondering if I should change the check boxes to option buttons so one will exclude the other but either way how do I automatically put the correct entry in the status field.

Thanks

VC
 
At the moment I presume you have a field for yes and a field for no in the table. If you can't have both yes and no as an answer then its best to use an option box otherwise the users will click all the boxes :rolleyes:

You should just have one field for the option box value in the table. Have 3 tickboxes on the OptionBox on the form with the values 1 for won, 2 for lost and 3 for live. Then on the AfterUpdate of the option box properties put this.

Code:
If Me.OptionBoxName = 1 Then
Me.Status = "Won"

ElseIf Me.OptionBoxName = 2 Then
Me.Status = "Lost"

Else

Me.Status = "Live"

End If

Make the optionBox default value = 3 (live) presumably thats where they all start.

Col
 
You could change it to 1 check box (triple state, Null (Live), True (Won), False (lost) )

or to a triple checkbox storing the value in 1 field.

Either is acceptable i think.

Use an Iif statement to display the correct value on the form
something like so:
=Iif( [YourWin];"Won"; iif([YourLost];"Lost";"Live"))

Greetz
 
Col

Thanks, this works fine when I'm entering the records using the form and the
correct entry (Live, Lost or Won) is entered into the table and also displayed
on the from in the relevant text box.

When I go back into the form, although the correct status is displayed in the status text box, the corresponding option group button remains selected for the default value 3 (Live). How can I get the selected option button to change and match the status field as I scroll the records depending on the status for the record.

Thanks again for your help.

VC
 
Up,

You have to have the ControlSource assigned the Option Group control name,
not the individual buttons name. The default name is usually something like
"frame01".

To assign it, Me.frame01 = 2.

Wayne
 

Users who are viewing this thread

Back
Top Bottom