Autofill yes/no field on form (1 Viewer)

QueryStumped

Registered User.
Local time
Today, 04:33
Joined
Mar 22, 2017
Messages
60
Hello...i have a form that needs to be programmed to fill a yes/no field automatically by a selection made from a combo box of another field. If nothing is chosen, then the yes/no field will remain empty. Would like to put the programming statement in the design view control source in the yes/no field of the form. Please advise.
 

Ranman256

Well-known member
Local time
Today, 04:33
Joined
Apr 9, 2015
Messages
4,337
Yes/no fields (boolean) only have 2 choices...yes, no.

If you use a combo box,with the words: 'yes','no'
THEN you can have a null.
 

QueryStumped

Registered User.
Local time
Today, 04:33
Joined
Mar 22, 2017
Messages
60
Thank you. What if I choose a selection from the combo box field, titled school, selecting Eastern High. How can I have another field, check box, to show automatically a checkmark?
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 18:33
Joined
Jan 20, 2009
Messages
12,853
If the checkbox is entirely dependent on the state of combobox then the checkbox value should not be stored in the table but determined by testing the School field for null.

Otherwise, test the combo and use the result to set the checkbox.

Code:
Private Sub cmbSchool_AfterUpdate
 
    Me.chkWhatever = Not IsNull(Me.cmbSchool)
 
End Sub
 

QueryStumped

Registered User.
Local time
Today, 04:33
Joined
Mar 22, 2017
Messages
60
Ok cool, Thank you. Will try once I get into the office. Really appreciate everyone's help.
 

Users who are viewing this thread

Top Bottom