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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data did not update in report

Status
Not open for further replies.

Tom81

Technical User
Sep 7, 2003
4
0
0
US
I have a client that reported a problem with a report not having the correct data. The report is based on a table that is recreated in the OnOpen event, using a make table query.
When they ran the report it showed data from about a month ago. They then closed the report and reran it and this time the data was correct.
Any ideas why it would do this?

The code that recreates the table is this:

Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_NoTable
DoCmd.SetWarnings False
DoCmd.DeleteObject acTable, "Table Name"
DoCmd.OpenQuery "MakeTable Query Name"
DoCmd.SetWarnings True

Exit_Report_Open:
Exit Sub

Err_NoTable:
If ObjectExists(acTable, "Table Name") = False Then
DoCmd.OpenQuery "MakeTable Query Name"
End If
End Sub


Also this database is on a Terminal Services server and is accessed remotely through Terminal Services.
The main problem the client has is that they have no way of knowing if the data is correct or not.
They just happened to catch it this time on this report.
Tom
 
I would create the table prior to ever opening the report. Is there a reason why you are attempting this in the On Open event in the report? Obviously, this is making the table too late for the report.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
The reason I am doing it in the On Open event is because the reports are being run from the switchboard.
I don't know of any way to make the table automatically before opening the report from the switchboard.
According to the Access Visual Basic help files the On Open event of a report takes place before the underlying query is run.
That is why I thought the way I am doing it should work and so far it has. This is the first time I have had this problem.
I guess if I have to I can create a form to preview/print the reports from to make sure the table gets created before the report is run.
Tom
 
The switchboard in Access allows you to run code. The code could run your query and then open the report.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thank you! I'll try that and see if they have any more problems.
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top