Problem with calling Access Report from VB
Hey,
I have a report in Access that I am opening from VB using the access object reference. For some reason when I originally open it to preview from the VB app it shows no data. If I go into design and back to preview the data appears. If I just open the DB manually and double click the report the data shows up. Anyone know what might cause the data not to appear upon originally opening the report through VB?
Thanks
Re: Problem with calling Access Report from VB
Weird issue. What and where is the recordseource for the report? Are you using any filters? Can you post some of the code you use to open your report? What version of Access?
Re: Problem with calling Access Report from VB
The recordsource is straight from a table in Access 2000. There are no filters but I did set the report to sort by one of the columns.
Here is the VB code I use to call it:
[Highlight=VB]
Set acAPP = New Access.Application
acAPP.OpenCurrentDatabase App.Path & "\reporting.mdb"
acAPP.Visible = True
acAPP.DoCmd.OpenReport "Report_Name", acViewPreview
acAPP.DoCmd.Maximize
[\vbcode]
I use the same exact code to call a few other reports that work fine. The only thing is the other reports pull data from queries instead of a table.
Re: Problem with calling Access Report from VB
As RD has alreadt stated.. wierd Issue..
Could you try replacing the table name in the RecordSource of the report to a "SELECT * FROM tableName ORDER BY FieldName" instead and see if that resolves it.
It could be that the code is executing too quickly for the database to open the table's data, doubt this is it but worth a shot..
Re: Problem with calling Access Report from VB
Thanks for the suggestion... tried it but was unsuccessful.
Re: Problem with calling Access Report from VB
Another shot in the dark.. but have seen this issue with some of my own reports...
Check the printer that the report is assigned to.
What version of Access and operating system are you on?
Re: Problem with calling Access Report from VB
I am just previewing the report, so I don't think the printer should matter. I am using Access 2000 on Win XP.
Re: Problem with calling Access Report from VB
Believe it or not it will matter.. if the default printer that the report is linked to is unavailable it will not display.
in fact this is what I stumbled across when I started experiencing report problems on Win XP..
Default Printers in Office 2000