Link to home
Start Free TrialLog in
Avatar of printmedia
printmedia

asked on

Run Access report after batch file has completed

Hi all.

I have a batch file that runs a SQL Server 2000 DTS. This DTS copies some tables that will be used in an Access report.

How can I go about opening the Access report AFTER the batch file has completed?

I tried using an Access macro, first I ran the batch file and the next step was to open the report but what would happen was the batch file would run and while it was running the access report was opened, this was causing incomplete data to appear on the report because the report was opening while the batch file was copying the tables. How can I fix this?

Thank you in advance.
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

It sounds like a timing issue in the batch file.  Can you post the batch file?
Avatar of printmedia
printmedia

ASKER

DTSRun /S "ServerName" /N "Copy Tables" /G "{CA005610-A55A-4209-8A3D-A4E99D844D67}" /W "0" /E 

if errorlevel 1 goto error
echo SUCCESSFUL!!!

PAUSE
goto end
:error
echo ERROR!!! 
PAUSE
:end

Open in new window

Where did you open the access report?  

If you are running Vista or newer then you can use the builtin timeout command. I would place it after the "echo SUCCESSFUL!!!" line and give it a delay of 1 minute to start with and disable keystrokes to break out of it. You can adjust the time by seconds until you get it figured out.

timeout /t 60 /nobreak
As a I mentioned above, I tried using an Access macro that would open the batch file and then open the Access report.

The report is in an Access database that is on a shared folder on the server. So your suggestion is to have the batch file open the report?

What syntax? We are on Windows XP machines with Access 2003.
How are you *actually* running the batch file?

Here is the way I would do this...
Put the Batch file in one sub, and the Open Report code in another:
Sub RunBatch()
    'Your code to run the batch here
End sub

Sub RunReport()
    'Your Open report code here
End sub

Then run them sequentially , like so:

Sub RunAll()
    Call RunBatch
    Call RunReport
End sub

JeffCoachman
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial