PC Review


Reply
Thread Tools Rate Thread

displaying checkboxes

 
 
=?Utf-8?B?a2ltYw==?=
Guest
Posts: n/a
 
      22nd Jun 2004
I have a parameter query tied to a form, that prints its results in a report. There are many checkboxes on the form. I want the checkboxes to display in the report only if they are selected in the form. If the checkbox is not selected, I don't want it to show up on the report. Can this be accomplished using vb script?

Thanks for your help.
 
Reply With Quote
 
 
 
 
Larry Linson
Guest
Posts: n/a
 
      22nd Jun 2004
For the purposes of the code example, let's say your form's name is frmF,
and the checkboxes are chkA, chkB, and chkC, and that you have named the
checkboxes in the report with identical names. And, the form must be open
when the report is running!

In the Print event of the Report:

Dim frm as Form
Set frm = Forms("frmF")
If frm!chkA = True Then Me!chkA.Visible = True
If frm!chkB = True Then Me!chkB.Visible = True
If frm!chkC = True Then Me!chkC.Visible = True
Set frm = Nothing

For the record: The code in an Access database is VBA (Visual Basic for
Applications), not vbscript. vbscript is an interpreted language, primarily
for web pages but usable elsewhere, supported by the Windows Scripting Host
(aka Windows Scripting Runtime). I do not recommend using vbscript with
Access applications because in many shops the system administrators have
removed the WSH from all machines because of the number of viruses and worms
that use vbscript to do their mischief.

Larry Linson
Microsoft Access MVP


"kimc" <(E-Mail Removed)> wrote in message
news:69D12730-8312-4BAB-9D8A-(E-Mail Removed)...
> I have a parameter query tied to a form, that prints its results in a

report. There are many checkboxes on the form. I want the checkboxes to
display in the report only if they are selected in the form. If the
checkbox is not selected, I don't want it to show up on the report. Can
this be accomplished using vb script?
>
> Thanks for your help.



 
Reply With Quote
 
=?Utf-8?B?a2ltYw==?=
Guest
Posts: n/a
 
      22nd Jun 2004
Not to be a total idiot - but where is the print event of a report?

"Larry Linson" wrote:

> For the purposes of the code example, let's say your form's name is frmF,
> and the checkboxes are chkA, chkB, and chkC, and that you have named the
> checkboxes in the report with identical names. And, the form must be open
> when the report is running!
>
> In the Print event of the Report:
>
> Dim frm as Form
> Set frm = Forms("frmF")
> If frm!chkA = True Then Me!chkA.Visible = True
> If frm!chkB = True Then Me!chkB.Visible = True
> If frm!chkC = True Then Me!chkC.Visible = True
> Set frm = Nothing
>
> For the record: The code in an Access database is VBA (Visual Basic for
> Applications), not vbscript. vbscript is an interpreted language, primarily
> for web pages but usable elsewhere, supported by the Windows Scripting Host
> (aka Windows Scripting Runtime). I do not recommend using vbscript with
> Access applications because in many shops the system administrators have
> removed the WSH from all machines because of the number of viruses and worms
> that use vbscript to do their mischief.
>
> Larry Linson
> Microsoft Access MVP
>
>
> "kimc" <(E-Mail Removed)> wrote in message
> news:69D12730-8312-4BAB-9D8A-(E-Mail Removed)...
> > I have a parameter query tied to a form, that prints its results in a

> report. There are many checkboxes on the form. I want the checkboxes to
> display in the report only if they are selected in the form. If the
> checkbox is not selected, I don't want it to show up on the report. Can
> this be accomplished using vb script?
> >
> > Thanks for your help.

>
>
>

 
Reply With Quote
 
Steven M. Britton
Guest
Posts: n/a
 
      22nd Jun 2004
In your report go into the design mode, click in the upper
left hand corner to select the entire report. Goto
properties and under the event tab you will see the
OnPrint, click the ... and select the code option.
>-----Original Message-----
>Not to be a total idiot - but where is the print event of

a report?
>
>"Larry Linson" wrote:
>
>> For the purposes of the code example, let's say your

form's name is frmF,
>> and the checkboxes are chkA, chkB, and chkC, and that

you have named the
>> checkboxes in the report with identical names. And, the

form must be open
>> when the report is running!
>>
>> In the Print event of the Report:
>>
>> Dim frm as Form
>> Set frm = Forms("frmF")
>> If frm!chkA = True Then Me!chkA.Visible = True
>> If frm!chkB = True Then Me!chkB.Visible = True
>> If frm!chkC = True Then Me!chkC.Visible = True
>> Set frm = Nothing
>>
>> For the record: The code in an Access database is VBA

(Visual Basic for
>> Applications), not vbscript. vbscript is an interpreted

language, primarily
>> for web pages but usable elsewhere, supported by the

Windows Scripting Host
>> (aka Windows Scripting Runtime). I do not recommend

using vbscript with
>> Access applications because in many shops the system

administrators have
>> removed the WSH from all machines because of the number

of viruses and worms
>> that use vbscript to do their mischief.
>>
>> Larry Linson
>> Microsoft Access MVP
>>
>>
>> "kimc" <(E-Mail Removed)> wrote in message
>> news:69D12730-8312-4BAB-9D8A-

(E-Mail Removed)...
>> > I have a parameter query tied to a form, that prints

its results in a
>> report. There are many checkboxes on the form. I want

the checkboxes to
>> display in the report only if they are selected in the

form. If the
>> checkbox is not selected, I don't want it to show up on

the report. Can
>> this be accomplished using vb script?
>> >
>> > Thanks for your help.

>>
>>
>>

>.
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jun 2004
"kimc" <(E-Mail Removed)> wrote in message
news:A32D495B-C135-4C76-A426-(E-Mail Removed)
> I'm in Access 2000 and under properties, I don't have an On Print
> option under the Event tab. I have On Open, On Close, On Activate,
> On Deactivate, On Data, On No Page and On Error.


Actually, it's each section of the report that has the Print event.
Select the Detail section (if that's where the check boxes are) and look
at its event properties.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
=?Utf-8?B?a2ltYw==?=
Guest
Posts: n/a
 
      22nd Jun 2004
Thanks - I found it. So, I only need to put this code in the detail section since that is the only place the checkboxes will be?

"Dirk Goldgar" wrote:

> "kimc" <(E-Mail Removed)> wrote in message
> news:A32D495B-C135-4C76-A426-(E-Mail Removed)
> > I'm in Access 2000 and under properties, I don't have an On Print
> > option under the Event tab. I have On Open, On Close, On Activate,
> > On Deactivate, On Data, On No Page and On Error.

>
> Actually, it's each section of the report that has the Print event.
> Select the Detail section (if that's where the check boxes are) and look
> at its event properties.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jun 2004
"kimc" <(E-Mail Removed)> wrote in message
news:34AA306E-DBB7-4DA0-AF3A-(E-Mail Removed)
> Thanks - I found it. So, I only need to put this code in the detail
> section since that is the only place the checkboxes will be?


That's right, unless there's something I don't know. I'm a little
concerned that maybe we're talking about multiple records on the form,
and multiple records on the report, and you want the check boxes to be
visible not depending on the status of the form's check boxes *for the
corresponding record* -- in which case this whole approach won't work,
since the form reference will only look at the current record on the
form. But try it and see if you get what you want.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Checkboxes displaying information. Brave Microsoft Frontpage 2 10th Oct 2006 01:42 PM
Displaying boxes of text and using checkboxes to select them =?Utf-8?B?SmFlIEhvb2Q=?= Microsoft Access 1 11th Jul 2005 07:06 PM
Checkboxes Trish Microsoft Excel Programming 2 11th Mar 2004 09:32 PM
combo box not displaying data if limit to list opetion set and displaying item not in list.... Chris Strug Microsoft Access Form Coding 4 3rd Oct 2003 03:44 PM
checkboxes RICHARD Microsoft Excel Worksheet Functions 1 8th Jul 2003 05:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:20 AM.