Solved

Form Checkboxes Yes / No

Posted on 2015-01-23
3
175 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

856 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