473,581 Members | 3,183 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When Checkbox is Checked on Form, want report to print Yes/No

Hi -
I've looked at many posts, and cannot find the answer on this specific
problem.

I have several fields on a table, which I've defined as "Text", 3
characters, Format Yes/No (I picked up the Text and Format Yes/No from
a Posting).

I have a form with a label and a check box for each item and the user
checks off the ones s/he wants to be "Yes".
Then, I print the value on different reports - and on the reports I
want "Yes" or "No" to print.

However, the reports are printing -1 for "yes" and "No" for "No". I
think this is because the table default value is "No", so they show
"No".

I can see that when I check a box on the form, the table value is -1,
and the display is -1.

Is there a way to have the checkbox, when checked "On" put "Yes" in
the table, and when checked "Off" (like if the user changed a "Yes" to
a "No"), put a "No" value in the table?

Thanks - Much appreciated.
Sara

On

Apr 6 '07 #1
4 13673
Hi Sara,

One option is to write a little bit of code in your report. Add a
Report level Recordset variable named RS just underneath
Option Compare Database
Option Explicit

Actually, Here is my sample code which uses a table called Table2 that
contains 2 fields, a Name field and a yes/no field that I named YesNo.
What I did was to set the Recordsource of the report to Table2 in the
Report initial creation. Then I added this code which will also work if
your table contains several fields:

------------------------------------------------------
Option Compare Database
Option Explicit

Dim RS As Recordset

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If RS!YesNo = 0 Then Text2 = "No"
If RS!YesNo = -1 Then Text2 = "Yes"
RS.MoveNext
End Sub

Private Sub Report_Open(Can cel As Integer)
Set RS = CurrentDb.OpenR ecordset("Table 2")
End Sub

--------------------------------------------------

Just replace "Table2" with your table Name and change
RS!YesNO to your yes/no fieldname.

HTH

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 6 '07 #2
I forgot to mention, the Text2 is an unbound textbox in the report
detail section. The other fields from your table will be bound to the
table fields. Just make the yes/no field unbound (just an ordinary
unbound textbox) and you populate the textbox with the code above.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 6 '07 #3
Hi Sara,

In your table design ... Why did you choose "Text" as the data type ... and
not "Yes/No"?
I'd start by making that change right off the bat.
While you're in the table design view, and after you have changed the
field's data type to "Yes/No", have a look at the field's property sheet.
If you click in the "Format" row of the property sheet, it becomes a
combo-box ... giving you 3 display options (Yes/No, True/False, On/Off)
("Display options" is the operative phrase here. The data really is 0 for
False, and -1 for True ... formatting it just changes the result displayed.)

Whatever format you choose here will be the DEFAULT format for all
newly-created forms and reports. Keep in mind that the format can be changed
at will on whatever form or report you want. Just change the Format setting
in the control's property sheet.

Actually, you may even be able to do that with things set up the way you
have them right now ... but I DO encourage you to change the Data Type of
the field at the table design level.
--
--
HTH,
Don
=============== ==============
E-Mail (if you must) My*****@Telus.n et

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code samples are also Access97- based
unless otherwise noted.

=============== =============== =============== =============== ==============
"sara" <sa*******@yaho o.comwrote in message
news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
Hi -
I've looked at many posts, and cannot find the answer on this specific
problem.

I have several fields on a table, which I've defined as "Text", 3
characters, Format Yes/No (I picked up the Text and Format Yes/No from
a Posting).

I have a form with a label and a check box for each item and the user
checks off the ones s/he wants to be "Yes".
Then, I print the value on different reports - and on the reports I
want "Yes" or "No" to print.

However, the reports are printing -1 for "yes" and "No" for "No". I
think this is because the table default value is "No", so they show
"No".

I can see that when I check a box on the form, the table value is -1,
and the display is -1.

Is there a way to have the checkbox, when checked "On" put "Yes" in
the table, and when checked "Off" (like if the user changed a "Yes" to
a "No"), put a "No" value in the table?

Thanks - Much appreciated.
Sara

On

Apr 6 '07 #4
On Apr 6, 7:00 pm, "Don Leverton" <leveriteNoJunk M...@telusplane t.net>
wrote:
Hi Sara,

In your table design ... Why did you choose "Text" as the data type ... and
not "Yes/No"?
I'd start by making that change right off the bat.
While you're in the table design view, and after you have changed the
field's data type to "Yes/No", have a look at the field's property sheet.
If you click in the "Format" row of the property sheet, it becomes a
combo-box ... giving you 3 display options (Yes/No, True/False, On/Off)
("Display options" is the operative phrase here. The data really is 0 for
False, and -1 for True ... formatting it just changes the result displayed.)

Whatever format you choose here will be the DEFAULT format for all
newly-created forms and reports. Keep in mind that the format can be changed
at will on whatever form or report you want. Just change the Format setting
in the control's property sheet.

Actually, you may even be able to do that with things set up the way you
have them right now ... but I DO encourage you to change the Data Type of
the field at the table design level.

--
--
HTH,
Don
=============== ==============
E-Mail (if you must) My.N...@Telus.n et

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code samples are also Access97- based
unless otherwise noted.

=============== =============== =============== =============== ==============

"sara" <saraqp...@yaho o.comwrote in message

news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
Hi -
I've looked at many posts, and cannot find the answer on this specific
problem.
I have several fields on a table, which I've defined as "Text", 3
characters, Format Yes/No (I picked up the Text and Format Yes/No from
a Posting).
I have a form with a label and a check box for each item and the user
checks off the ones s/he wants to be "Yes".
Then, I print the value on different reports - and on the reports I
want "Yes" or "No" to print.
However, the reports are printing -1 for "yes" and "No" for "No". I
think this is because the table default value is "No", so they show
"No".
I can see that when I check a box on the form, the table value is -1,
and the display is -1.
Is there a way to have the checkbox, when checked "On" put "Yes" in
the table, and when checked "Off" (like if the user changed a "Yes" to
a "No"), put a "No" value in the table?
Thanks - Much appreciated.
Sara
On- Hide quoted text -

- Show quoted text -
Thanks, Don - I did it!

The key was where you said "a new report" will show the changes. And
it did!

The reason I set it up the way I did is that I first did Yes/No and I
saw Check boxes in the table and didn't like that. So, I looked in
this user group and got the solution for Text and yes/no formatting.
When that still didn't work, I posted my problem myself.,

You might be right that it might have worked my way if I'd done a new
report, but this works, so I'm moving on.

Again, MANY thanks.

sara

Apr 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3498
by: John Mullen | last post by:
I want to take the following HTLM and use javascript to turn on radio buttons if checkbox is checked, can I do this with javascript (maybe onClick or an array) or do i need a server side script ? <li>ABACAVIR SULFATE</li> <INPUT NAME="ingredient0" TYPE=checkbox VALUE="ABACAVIR SULFATE"><br> <input name="ABACAVIR SULFATE AMOUNT" type="radio"...
12
2962
by: zig | last post by:
I've posted this on alt.comp.lang.coldfusion, but is predominantly a javascript problem: I have a CF query which returns several rows of records. I wanted to have a checkbox on each record of that returned query which would allow the user to select which record to print if checked. As the checkboxes are generated within the CF, they all...
3
2772
by: Rich | last post by:
I have a form with 2 check boxes. One of the check boxes is used to specify that the user is a "primary contact." When I check the primary contact box I want a second box for "standard contact" to be checked as all primary contacts must be standard contacts. If I uncheck the primary contact no change in status of the standard contact is...
4
26963
by: Piotr | last post by:
how can I read (in alert for example) array index number of checked checkbox? I have: <input type="checkbox" id="id_number" name="check" value="1" onclick="show()"/> <input type="checkbox" id="id_number" name="check" value="2" onclick="show()"/> <input type="checkbox" id="id_number" name="check" value="3"
6
1944
by: Megan | last post by:
Hi everybody- I'm trying to use a checkbox to control whether or not a date field in a query "Is Null" or "Is Not Null." I have 2 date fields: InDate and OutDate. If there is an OutDate, then the record is finished. If there is no OutDate, then the record is not finished. I'm using an unbound form (frmStatus) to enter data into a query...
2
9185
by: /.. | last post by:
Hi all, I'm working on a report display page that currently uses 5 checkboxlists with a total of 86 items to display values from 5 different tables in an Access database. The page works fine now. On presenting it to the users they pointed out that their users could change the values in the checkboxes and then print them out, ultimately...
1
4491
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a checkbox and I can't get it to default to checked. I tried radiobuttons and experienced the same result.. can't start them as checked. The really...
34
3773
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript function needs to run and validate all the checkboxes on my form and make sure none of them are unchecked. I suck at Javascript and my problem is...
6
2279
by: jinfo | last post by:
I was assigned the task of creating a small database by my office. I created a table with the appropriate field ID, Project, and Approve (checkbox). Then I created a Form of the table. But when I run my reports I see the actual check boxes. I am trying to understand what I am doing wrong. What I would like to happen is when a person...
0
7860
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8299
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8166
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6546
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3799
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3813
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.