K
Kevin Bruce
Here's the situation:
My program prints Letters of Agreement and invoices plus records the date on
which they were printed.
I have have an On_Click procedure that is intended to do the following:
If the contract and invoice have not yet been created, then print them and
record the date.
If they have already been printed and the dates recorded, simply preview
them.
Trust me, everything insofar as update queries and SQL statements for the
various objects works.
The problem: when creating new invoices, the data does not refresh at the
point where it is needed to create and print the invoices.
Note: the text box 'txtContractedToPresenter' is key here. If there is a
date in this text box, the print preview routine works just fine. Although
SQL statements for both the contract and the invoice are almost identical,
the invoice still does not print -- it contains an empty record set.
Private Sub cmdPrintOrPreview_Click()
Dim stDocName As String
Dim intPrintCount As Integer
Dim strContractDate As String
txtContractedToPresenter.SetFocus
strContractDate = txtContractedToPresenter.Text
If strContractDate = "" Then
'update invoice number
stDocName = "qryInvoiceNumberUpdate"
DoCmd.OpenQuery stDocName
'update the records to show that the Agreement has been issued
'and record the booking fee invoice number for each event
stDocName = "qryBookingContractedToPresenterUpdate"
DoCmd.OpenQuery stDocName, acNormal, acEdit
'Print the Agreement
stDocName = "rptBookingPresenterAgreement"
DoCmd.OpenReport stDocName, acNormal
[THIS IS THE POINT WHERE THE PROBLEM OCCURS]
'print the Booking Fee Invoice
stDocName = "rptBookingFeeInvoice"
DoCmd.OpenReport stDocName, acViewNormal
'print the Presenter's schedule
stDocName = "rptBookingPresenterSummary"
DoCmd.OpenReport stDocName, acNormal
Else
'Preview the Agreement
stDocName = "rptBookingPresenterAgreement"
DoCmd.OpenReport stDocName, acViewPreview
'print the Booking Fee Invoice
stDocName = "rptBookingFeeInvoice"
DoCmd.OpenReport stDocName, acViewPreview
'print the Presenter's schedule
stDocName = "rptBookingPresenterSummary"
DoCmd.OpenReport stDocName, acViewPreview
End If
End Sub
My program prints Letters of Agreement and invoices plus records the date on
which they were printed.
I have have an On_Click procedure that is intended to do the following:
If the contract and invoice have not yet been created, then print them and
record the date.
If they have already been printed and the dates recorded, simply preview
them.
Trust me, everything insofar as update queries and SQL statements for the
various objects works.
The problem: when creating new invoices, the data does not refresh at the
point where it is needed to create and print the invoices.
Note: the text box 'txtContractedToPresenter' is key here. If there is a
date in this text box, the print preview routine works just fine. Although
SQL statements for both the contract and the invoice are almost identical,
the invoice still does not print -- it contains an empty record set.
Private Sub cmdPrintOrPreview_Click()
Dim stDocName As String
Dim intPrintCount As Integer
Dim strContractDate As String
txtContractedToPresenter.SetFocus
strContractDate = txtContractedToPresenter.Text
If strContractDate = "" Then
'update invoice number
stDocName = "qryInvoiceNumberUpdate"
DoCmd.OpenQuery stDocName
'update the records to show that the Agreement has been issued
'and record the booking fee invoice number for each event
stDocName = "qryBookingContractedToPresenterUpdate"
DoCmd.OpenQuery stDocName, acNormal, acEdit
'Print the Agreement
stDocName = "rptBookingPresenterAgreement"
DoCmd.OpenReport stDocName, acNormal
[THIS IS THE POINT WHERE THE PROBLEM OCCURS]
'print the Booking Fee Invoice
stDocName = "rptBookingFeeInvoice"
DoCmd.OpenReport stDocName, acViewNormal
'print the Presenter's schedule
stDocName = "rptBookingPresenterSummary"
DoCmd.OpenReport stDocName, acNormal
Else
'Preview the Agreement
stDocName = "rptBookingPresenterAgreement"
DoCmd.OpenReport stDocName, acViewPreview
'print the Booking Fee Invoice
stDocName = "rptBookingFeeInvoice"
DoCmd.OpenReport stDocName, acViewPreview
'print the Presenter's schedule
stDocName = "rptBookingPresenterSummary"
DoCmd.OpenReport stDocName, acViewPreview
End If
End Sub