PDA

View Full Version : Solved: Need help writing for an "On Click"



daniels012
04-02-2009, 11:25 AM
I need to get this in some how:

If (Forms!FrmWorkOrderData!NoChargeWO = True) Then
Reports!RptWorkOrder!NoChargeWOLabel.Visible = True
End If
If (Forms!FrmWorkOrderData!NoChargeWO = True) Then
Reports!RptWorkOrder!NoChargeWO2.Visible = True
End If

I need to open RptWorkOrder do the stuff above then print it then close the report.
Then open RptWorkOrderInfoSheet print it, then close it as well.

How can I write code to do this please?
Thank You,
Michael

nepotist
04-02-2009, 12:18 PM
use open report command rather than visible

if frmworkorderdata!nochargewo=true then docmd.openreport "ReportName",acPreview



I am a bit confused.. as to what is the nochargewo ?? is that a control on report??

daniels012
04-02-2009, 12:40 PM
This is just on part...
If the {frmworkorderdata!nochargewo} checkbox is checked then make this {Reports!RptWorkOrder!NoChargeWOLabel} label visible.

Once this is done i need:
Open RptWorkOrder then print it then close the report.
Then open RptWorkOrderInfoSheet print it, then close it as well.

Is this clearer?
Michael

daniels012
04-03-2009, 06:09 AM
any ideas?

daniels012
04-06-2009, 12:38 PM
bump

nepotist
04-07-2009, 06:17 AM
Here is what I was able to figure and it worked with my test
If frmworkorderdata!nochargewo = true then
docmd. openreport "Reports!RptWorkOrder", acviewpreview
docmd.Reports!RptWorkOrder!NoChargeWOLabel.visible = true
docmd. openreport "Reports!RptWorkOrder"
docmd.Close acReport ,"Reports!RptWorkOrder",acSaveNo
end if

The above code opens the report based on the condition set the lable's visible property to true and open report in preview, prints, and the closes it..

make appropriate changes with you conditions it should work. remember to set the lables visible property to true before you close it , so that it wouldnt be a problem when you open it next time