View Full Version : Report sections from Forms


GPattinson
08-24-2000, 02:37 AM
Please help,
Is it possible for fields to be displayed on a report if an icon has been clicked on a form, and then not displayed if the relative icon is not clicked?
Cheers, Gordon

accesswatch
08-24-2000, 04:44 AM
You can do this by making your report field visible or not visible by referencing the value on the form in code.
e.g
On your report you have a field called 'txtField01' with a visible property value set to false

On your form you have a checkbox with True/False values Yes/No field called 'tglPrintOnOff'

In the report sections OnFormat event reference the value of the Form and then set the reports field 'visible' property to true or false based on the value retrieved from the Form field

example

Private sub Detail_Format(Cancel as integer, formatCccount ass integer)

if Forms!frmFRED!tglPrintOnOff = true then
me.txtField01.visible=true
else
me.txtField01.visible=false
end if
end sub

If you can get hold of it Chapter 9 of the SYBEX 'Access 97 Developer's Handbook' is a very good chapter on Report design with many examples of manipulating reports in code

Hope this helps
Trevor from Accesswatch.co.uk

GPattinson
08-29-2000, 06:33 AM
Cheers for that, but after days of trying i just couldn't get it to work.
Is there any way this can be done without using code??
Thanks
Gordon