Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switchboard display problem after returning from report run 1

Status
Not open for further replies.

drazeni

Programmer
Apr 21, 2001
66
ZA
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?
 
Hmm... you could try closing, then opening the switchboard via macro or code.
 
Thanks for the feedback James, I have sorted the problem. I was deleteing the temporary SQL query in the report code instead of in the original form I was executing the report in.

Much appreciated "All is not as it seems"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top