I have a DB with a switchboard and a form to reprint an invoice. I execute the "reprint" form, select the invoice number and submit the print with the VBA OpenReport command. An sql query retrieves the corresponding data and then I execute the OpenReport command on four seperate instances.
My problem is that when the "reprint" form is finally closed, and it is time to go back to the switchboard, the graphics of the switchboard are messed up and requires refreshing. It's as if the process is too fast for the switchboard graphics to return normally.
I have tried form_switchboard.refresh , ...repaintobject, ...requery
also tried docmd.refresh acform, "switchboard"
Although when I choose to openreport with acPreview and I close the report manually, all is ok, but this doesn't let me preview the subsequent instances of the report.
My coding in the form is as follows:
'construct a querydef for the MAIN report, to retrieve only records that equal to the invoice number--->
Dim dbs As Database, mainqdf As QueryDef, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT * FROM Invoices WHERE [invoice number]" _
& "= " & [invoice_number] & ";"
Set mainqdf = dbs.CreateQueryDef("mainquery", strSQL)
DoCmd.OpenQuery "mainquery"
'construct a querydef for the SUB report, to retrieve only records that equal to the invoice number--->
Dim subqdf As QueryDef
strSQL = "SELECT * FROM [invoice details] WHERE [invoice number]" _
& "= " & [invoice_number] & ";"
Set subqdf = dbs.CreateQueryDef("subquery", strSQL)
DoCmd.OpenQuery "subquery"
Let query_close_switch = False
Let str_invoice_type = "JOB"
DoCmd.OpenReport "invoices"
Let str_invoice_type = "TAX INVOICE"
DoCmd.OpenReport "invoices"
Let str_invoice_type = "COPY TAX INVOICE"
DoCmd.OpenReport "invoices"
Let query_close_switch = True
Let str_invoice_type = "DELIVERY NOTE"
DoCmd.OpenReport "invoices"
The coding in my report is as follows:
Private Sub Report_Close()
'delete the temporary report queries created
If query_close_switch = True Then
DoCmd.Close acQuery, "mainquery"
DoCmd.Close acQuery, "subquery"
DoCmd.DeleteObject acQuery, "mainquery"
DoCmd.DeleteObject acQuery, "subquery"
End If
End Sub
ANY SUGGESTIONS PLEASE?
My problem is that when the "reprint" form is finally closed, and it is time to go back to the switchboard, the graphics of the switchboard are messed up and requires refreshing. It's as if the process is too fast for the switchboard graphics to return normally.
I have tried form_switchboard.refresh , ...repaintobject, ...requery
also tried docmd.refresh acform, "switchboard"
Although when I choose to openreport with acPreview and I close the report manually, all is ok, but this doesn't let me preview the subsequent instances of the report.
My coding in the form is as follows:
'construct a querydef for the MAIN report, to retrieve only records that equal to the invoice number--->
Dim dbs As Database, mainqdf As QueryDef, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT * FROM Invoices WHERE [invoice number]" _
& "= " & [invoice_number] & ";"
Set mainqdf = dbs.CreateQueryDef("mainquery", strSQL)
DoCmd.OpenQuery "mainquery"
'construct a querydef for the SUB report, to retrieve only records that equal to the invoice number--->
Dim subqdf As QueryDef
strSQL = "SELECT * FROM [invoice details] WHERE [invoice number]" _
& "= " & [invoice_number] & ";"
Set subqdf = dbs.CreateQueryDef("subquery", strSQL)
DoCmd.OpenQuery "subquery"
Let query_close_switch = False
Let str_invoice_type = "JOB"
DoCmd.OpenReport "invoices"
Let str_invoice_type = "TAX INVOICE"
DoCmd.OpenReport "invoices"
Let str_invoice_type = "COPY TAX INVOICE"
DoCmd.OpenReport "invoices"
Let query_close_switch = True
Let str_invoice_type = "DELIVERY NOTE"
DoCmd.OpenReport "invoices"
The coding in my report is as follows:
Private Sub Report_Close()
'delete the temporary report queries created
If query_close_switch = True Then
DoCmd.Close acQuery, "mainquery"
DoCmd.Close acQuery, "subquery"
DoCmd.DeleteObject acQuery, "mainquery"
DoCmd.DeleteObject acQuery, "subquery"
End If
End Sub
ANY SUGGESTIONS PLEASE?