Solved

Form Checkboxes Yes / No

Posted on 2015-01-23
3
169 Views
Last Modified: 2015-01-24
I have a simple update form with data being stored in an MSAccess database.
The checkboxes are recording a "Yes" when the user checks the appropriate selection.
If the user unchecks one of the checkbox that was checked, a -1 gets stored in the database.

How do I get a "NO" or delete the "Yes" when the user unchecks the box.

My code for the checkbox is

	<input type="checkbox" name="Dialog" value="Yes" <%If Dialog = "Yes" then response.write "checked" End If%>><font size="2">Dialog<br>

Open in new window

0
Comment
Question by:Malloy1446
3 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40567455
The problem with checkboxes is that if they are not checked, they are not included in the submit data.  I would set the default value to '-1' and only change it if the "Dialog" value of 'Yes' is submitted.
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 150 total points
ID: 40567456
Actually, if the field in the database is a Yes/No field, then when the user checks the check-box, the value should be -1 and when it is unchecked, the value should be 0.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 350 total points
ID: 40567813
If I am understanding your request correctly...
If you want to actually display a "Yes" or "No"...
You can create a textbox on your form/report, with a control source of:
    =IIf([YourYesNoField]=-1,"Yes","No")

There can be many refinements of this basic technique (VBA If/Then/else or Select-case, Combobox lookup, ...etc)
But this might start you off...

JeffCoachman
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now