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

open a snapshot 3

Status
Not open for further replies.

zrzr

Programmer
May 22, 2003
83
FR
Hi !!!!

In the database i'm developping, I have a report which is saved as a snapshot file every week(with a different name depending on the numeber of the week).

I exported it with outputto and it works very well.

Now, I want to open these files from access :

* show the openfile dialogbox to select the right file
* then, display this file

Is it possible to perform this ? and how ???
 
If your open dialog statement will select the right file for you then I believe you can open the file with a Shell statement:
Dim x as variant
Dim vPathToFile as string
'Open Dialog Code
x = Shell(vPathToFile, 1)

I will have to post back with the code for the Open Dialog for retrieving the path for you. I can't lay my fingers on it right off.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Okay, I found the thread. Use the code provided by ToeShot in thread: thread181-559152

This code works great for browsing for a file. This function returns the path of the file picked which then can be used in the Shell statement.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
This is the complete code to execute your request. Copy and paste the code from the thread above into a new database module and then put this code behind a button:

Dim x as variant
Dim vPathToFile as string
vPathToFile = ap_FileOpen()
x = Shell(vPathToFile, 1)

Post back with any problems.


Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
I did think there was a VBA function like OpenFileDialog, of something, but it should have been too easy ...
So I could have searched for a long time !!!

Thanks a lot scriverb !!!!!
 
Glad to be of help. Thanks for the Star as it is much appreciated.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Hum ... Hi again ...

Actually, the openfile dialog works very well, but I have a problem with Shell.
When I use it, I get an error (I have the french version of Access) :

error 5 : Argument ou appel de procédure incorrect

So I try to translate :

incorrect argument or call of procedure

But I use exactly the same code as you ... what's wrong ?
 
Could you not use (instead of the Shell command in Scriverb's code):

Application.FollowHyperlink vPathToFile

This stops opening the command prompt window in the background, and is roughly the equivalent of double clicking the file in Windows explorer.

John
 
It's much better !!!

Thanks too John !!!!
 
Way to go John. Thanks for the help on this one. Star for you.

ZrZr: Please email me. See my profile.


Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top