Access snapshots with VBScript

  • Thread starter Thread starter Primoz Bradac
  • Start date Start date
P

Primoz Bradac

I apologize for this article not being quite in line with the name of
the group but I think it is the closest...

I make a snapshor (of a report) with a (VBScript) script which runs as
follows:
------
Const acOutputReport = 3
Const acOutputFormat = "Snapshot Format"
Const db = "C:\_Temp\Auto\MyDB.mdb"
Const snap = "C:\inetpub\wwwroot\test\rptKatalog.snp"
Dim oAccess

Set oAccess = GetObject(db,"Access.Application")
oAccess.DoCmd.OutputTo acOutputReport, "rptKatalog", acOutputFormat,
snap

oAccess.Close
set oAccess = Nothing
------
The script runs OK but one problem I have is that after running it the
data base seems to stay locked (there is MyDB.ldb in the directury and I
cant open MyDB.mdb by doubleclicking it any more)
What statement did I forget in my script?

The second question is:

If I set acOutputFormat to "Snapshot Format (*.snp)" in above script
which is what I get if I do ?acFormatSNP in the Immediate Window of the
VBE in Access, in at least one computer this "format" is not recognized
and I have to change it to the above value ("Snapshot Format").

I'd really appreciate any explanation.
TIA,
Primoz
 
You might try using
oAccess.Quit
instead of
oAccess.Close

Do all your PCs have the same version of Access? Same patch level?

- Turtle
 
Hi Turtle!

Your suggestion saved the problem of locking (funny, Access or VBscript
hadn't protested to Close method!)

As for versions... I have two computers, both with Office 2003 Prof, the
difference between them is one (the one on which the thing doesn't work)
has a localized (to Slovenian) version of the Office, the other one has
the English version. Maybe that is the cause. Anyway I'll try on other
computers and let you know about the result.

Thank you for your help!
Primoz
 
Back
Top