Report Doesnt Exsit

D

DS

This report prints, but after it prints I get a message saying that the
report doesnt exsit. Is this a timing issue? Any help appreciated.
Thnaks
DS



DoCmd.OpenReport "rptCheck", acViewPreview
Reports!rptCheck!TxtDate = Me.SalesDate
Reports!rptCheck!TxtTime = Me.SalesTime
Reports!rptCheck!TxtInfo = Me.INFO
Reports!rptCheck!TxtServer = Me.ServerName

Reports!rptCheck!TxtSub = Me.TxtSub
Reports!rptCheck!TxtTax = Me.TxtTax
Reports!rptCheck!TxtDivideTotal = Me.TxtDivideTotal

If Forms!frmCheckPreview!ChkDividedCheck = True Then
Reports!rptCheck!TxtDivideTotal.Visible = True
Reports!rptCheck!TxtTotal.Visible = False
ElseIf Forms!frmCheckPreview!ChkDividedCheck = False Then
Reports!rptCheck!TxtDivideTotal.Visible = False
Reports!rptCheck!TxtTotal.Visible = True
End If

Reports!rptCheck!TxtService = Me.TxtService
Reports!rptCheck!TxtGratuity = Me.TxtGratuity
Reports!rptCheck!TxtDivideGrand = Me.TxtDivideGrand

If Forms!frmCheckPreview!ChkKillTax = True Then
Reports!rptCheck!Label62.Visible = False
Reports!rptCheck!LabelFree.Visible = True
ElseIf Forms!frmCheckPreview!ChkKillTax = False Then
Reports!rptCheck!Label62.Visible = True
Reports!rptCheck!LabelFree.Visible = False
End If
 
M

Marshall Barton

DS said:
This report prints, but after it prints I get a message saying that the
report doesnt exsit. Is this a timing issue?

DoCmd.OpenReport "rptCheck", acViewPreview
Reports!rptCheck!TxtDate = Me.SalesDate
Reports!rptCheck!TxtTime = Me.SalesTime
Reports!rptCheck!TxtInfo = Me.INFO
Reports!rptCheck!TxtServer = Me.ServerName

Reports!rptCheck!TxtSub = Me.TxtSub
Reports!rptCheck!TxtTax = Me.TxtTax
Reports!rptCheck!TxtDivideTotal = Me.TxtDivideTotal

If Forms!frmCheckPreview!ChkDividedCheck = True Then
Reports!rptCheck!TxtDivideTotal.Visible = True
Reports!rptCheck!TxtTotal.Visible = False
ElseIf Forms!frmCheckPreview!ChkDividedCheck = False Then
Reports!rptCheck!TxtDivideTotal.Visible = False
Reports!rptCheck!TxtTotal.Visible = True
End If

Reports!rptCheck!TxtService = Me.TxtService
Reports!rptCheck!TxtGratuity = Me.TxtGratuity
Reports!rptCheck!TxtDivideGrand = Me.TxtDivideGrand

If Forms!frmCheckPreview!ChkKillTax = True Then
Reports!rptCheck!Label62.Visible = False
Reports!rptCheck!LabelFree.Visible = True
ElseIf Forms!frmCheckPreview!ChkKillTax = False Then
Reports!rptCheck!Label62.Visible = True
Reports!rptCheck!LabelFree.Visible = False
End If


Since you are opening the report in preview and it is not in
Dialog mode, you should not gett that error from the posted
code. Is there any other code or expression the referenced
the report?

That said, trying to "push" values into a report is always a
timing issue. The reliable way is for the report to "pull"
the values from the form(s?) using code in the Format event
of the section that contains the target control.
 
D

DS

Marshall said:
DS wrote:





Since you are opening the report in preview and it is not in
Dialog mode, you should not gett that error from the posted
code. Is there any other code or expression the referenced
the report?

That said, trying to "push" values into a report is always a
timing issue. The reliable way is for the report to "pull"
the values from the form(s?) using code in the Format event
of the section that contains the target control.
Thanks Marshall. I switched to pulling the values from the form and
that works. The nly problem I have now is having a field visible or not
on the IF statement. How would I do that?
Thanks
DS
 
M

Marshall Barton

DS said:
Thanks Marshall. I switched to pulling the values from the form and
that works. The nly problem I have now is having a field visible or not
on the IF statement. How would I do that?

Essentially the same way. I'm not sure which "field" or If
is giving you trouble, but, because you used fully qualified
references, the code could be the same as you have in the
form. If you have a mind to, the code could be reduced to
just this:

With Forms!frmCheckPreview
Me!TxtDivideTotal.Visible = !ChkDividedCheck
Me!TxtTotal.Visible = Not !ChkDividedCheck
Me!Label62.Visible = Not !ChkKillTax
Me!LabelFree.Visible = !ChkKillTax
End With

Note that normally this kind of thing should be done in the
Format event of the section displaying the controls, but
since you are only manipulating the Visible property (not
their Value) based on values that will not change for the
duration of the report, you can put it in the Open event.
 
D

DS

Marshall said:
DS wrote:




Essentially the same way. I'm not sure which "field" or If
is giving you trouble, but, because you used fully qualified
references, the code could be the same as you have in the
form. If you have a mind to, the code could be reduced to
just this:

With Forms!frmCheckPreview
Me!TxtDivideTotal.Visible = !ChkDividedCheck
Me!TxtTotal.Visible = Not !ChkDividedCheck
Me!Label62.Visible = Not !ChkKillTax
Me!LabelFree.Visible = !ChkKillTax
End With

Note that normally this kind of thing should be done in the
Format event of the section displaying the controls, but
since you are only manipulating the Visible property (not
their Value) based on values that will not change for the
duration of the report, you can put it in the Open event.
Thank You Marshall!
DS
 
Top