PDA

View Full Version : select field to print



ThaNguyen
01-05-2009, 12:04 PM
Hello,

I have a report form that have 3 fields to print

QTY SALES MARGIN

Is there a way to could use one report form to print without the last column (MARGIN) to show if the user chose to do so.

Right now I have two forms created one with Margin the the other is not, it is working ok but I am looking for a way to put it vb code but not sure where to start.

Any help would be greatly appreciated

OBP
01-06-2009, 05:13 AM
Yes you can, but you will need something to trigger whether or not to show it on the Report, like a Tick box or Option Group.
You can then use that on the Report to set the Field's "Visible" property to "Yes" or "No".

ThaNguyen
01-06-2009, 07:11 AM
I figured that you have to set it visible to yes or no and that is what I did on a second report I just copied the first report and set the last field to not visible and renamed.

I am not sure what are the syntax on vb to put it together can you just give me an example?

Thanks

OBP
01-06-2009, 07:32 AM
The VBA would go in the Details "On Format" event procedure and would be sometihing like
if forms![Formname]![CheckBoxName] = -1 then
me.MARGIN.Visible = False
else
me.MARGIN.Visible = True
end if

where FormName is the Name of the form that has the Checkbox on it (the checkbox cold be included in the Reports query instead) and Checkboxname is the name of your check box.

ThaNguyen
01-06-2009, 08:08 AM
Thank you very much it took a few tries but i finally figured it out.

You're awesome, much appreciated