How do I limit a response to either yes or no in base form field? I’ve tryed everything I know, including Boolean yes/no, list drop down and combo box.
Which problems do you get with Check-Box? Set it to 3-state ‘no’, also set the table to “Not Null” for the boolean field and it will work.
All I want is for the user to arrive at a simple text field which already is displaying “No”
If they enter “Y” , No will change to “Yes”, with no other options. Or, something like that.
The list and combo’s were just me trying to get anything to work.
Anybody else?
Thank you
I didn’t wrote again, because I didn’t understand what you want. Should there really be set ‘yes’ in the field of the table? This is a text content, not boolean. You could use a listbox for this behavior.
Or do you want to click on something, which shows ‘yes’ and in the table it is saved as boolean. You could use a checkbox or radiobuttons for this behavior.
Field in the table has to be NOT NULL, because you only want ‘yes’ or ‘no’.
NoToYes.odb (12.3 KB)
Hi Robert,
I don’t think Boolean fields will help me. I have other fields, such as Urgent/asap, where the default is “asap” and the employee, upon arrival, can change it to “urgent” by pressing the “u” key.
These are the only two choices available.
Thank you
I appreciate your understanding!
Tom
Can you not use the same principle you use for the Urgent/ASAP field? The concept is the same, just different text displayed.
Unfortunately I can’t make it work for either:
[Print] Yes or No, with default “No”
[Urgent_Asap] Urgent or Asap, with default “Asap”
Fields
I thought if I could get rid of the dropdown arrow from the [print] field it would be perfect, but when I do that the field displays a weird Yes No scroll bar.
booleans.odb (14.0 KB)
is a demo for boolean fields (yes/no or null). In table “BOOLS” the boolean fields can be null (empty) as shown in the table’s design view. In “BOOLS2” I made them not nullable. Any records with missing booleans will not be stored to table “BOOLS2”
- If the boolean values are nullable, you can not use any option buttons on forms, as demonstrated on the yellow form linked to table “BOOLS”. Check boxes work alright.
- Option buttons do work when the booleans are not nullable as demonstrated in the red form linked to table “BOOLS2”.
Hi V,
This is all very confusing to me. I don’t want to use any buttons, dropdown or checkboxes, and need to do it for a field that is not yes/no.
Is it possible to send you a screen shot of my form?
Tu
Don’t send screen shots unless you have a display problem. Just send documents.
A yes/no, true/false, on/offf form field is a check box, alternatively a pair of option buttons. The underlying data type in a table column is Boolean. If the table column is allowed to be Null (Empty), the form field should be set up to show three different states True, False and Null.
If you want to display verbatim “yes” or “no”, just add a pair of option buttons to your form with labels “yes” and “no”. Due to a known bug, this does not work if the underlying fields are nullable.
Okay, I thought I’d try adding a new yes/no Boolean field to my existing table leaving what I have and copying your tbl_Yes/No, setup parameters for [BooYesNo] field,
Entry required: yes
Length:0
Default value: No
I created this field:
Print2, Yes/No [Boolean]
Entry Required “Yes”
Length “1” (It wouldn’t let me enter 0)
Default value “No”
I tryed to save and got the following error:
Column constraints are not acceptable in statement [Alter Table “main work orders” Add “print2” Boolean not null]
Me not knowing how to make it “Null” is maybe the problem?
Ps Thanks again for you, all of you, helping me get over the hump on this!!
You have a table that contains several records already. Now you add a field which is not allowed to contain any blank values. For logical reasons, this is not possible. Default value False applies to newly inserted records only.
If your table already contains records, delete all the records if they are just dummy records for testing. If you want to keep them, create a nullable field, then fill them with values, and when every existing record has a boolean value, you will be able to make it not nullable.
I was able to use a macro to get yes, no, default print.
I’ll keep trying to understand Boolean fields and why I can find or set “null” in the table setup, or why I can’t change the length to zero.
Thank you
For a report or something:
SELECT *, CASE WHEN "BOOL"=True THEN 'Yes' ELSE 'No' END FROM "Somewhere"