473,761 Members | 10,498 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 13687
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
3504
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" value="EQ 300MG BASE">EQ 300MG BASE<br> <input name="ABACAVIR SULFATE AMOUNT" type="radio" value="EQ...
12
2977
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 have tha same name. With the help of a fellow a.c.l.c. member, we've got the script to a point...
3
2792
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 needed. I am assuming I can use some onclick function but I tried using a onclick on the one box to...
4
26977
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
1951
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 to
2
9206
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 documenting false information.
1
4510
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 frustrating thing is that I set the attributes of other input controls in the Init() with no problem. ...
34
3832
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 2fold. I have the following code that constructs the checkbox response.write "<input type=checkbox...
6
2284
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 clicks the approve check box it says yes on the report, and when the check box is not checked it should...
0
9521
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8768
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5214
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3863
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
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.