Pause Access to allow VBS script from hyperlink to run

ComptechRx

Registered User.
Local time
Yesterday, 19:13
Joined
Mar 14, 2011
Messages
13
Hi all, I've got a form set up with fields that have hyperlinks to vbs script files. What I'm looking to do is have the user click the link so the script will run and then have Access close automatically so the user doesn't leave it running. I've messed around with Application.Quit as a macro but Access closes before the script runs. Any help on this would be greatly appreciated. TIA
 
Why have the script in first place? Why not just put the content of script inside Access VBA procedure instead and execute it within Access - that way it'll be processed synchronously and you can then call Quit at the end of the procedure.
 
We use the VBS script to create local copies of project files for us. Each script gets placed in a project folder. I use the drag & drop feature in Access to store the location of the script file as a hyperlink in a field. This way I can manage all the paths for all projects in 1 database and place the front end file on each users desktop. If I can get Access to pause for 5 seconds so the hyperlink will run before closing, it would be great.
 
Okay, then. Google for "ShellAndWait".
 
Thank you very much, I will give that a try. Will also like to hear of any other solutions that are available and less complex in terms of code. Thanks again!
 
I came across some simple code that adds a pause when clicking the field that contains the hyperlink:

Public Sub fnPause(dblSeconds As Double)

Dim sngTime As Single

sngTime = Timer + dblSeconds
Do
Loop Until Timer > sngTime
End Sub


Code:
fnPause(X) ' X = the number of seconds to pause



This does the trick perfectly.

The control I have set up that users click is called ProjectScript. Now I just need to figure out how to code the event procedure to pause for 3 seconds to allow the hyperlink to run before Access closes using QuitAccess. Yes, I am a noobie. TIA
 
Doing a "wait" in this situation is similar to flying by dead-reckoning: you are not sure where you are, but the time says you are in the right place. Are you? Always?

Have you considered altering the VBS-script, so it on completion eg. generates a time-stamp in a file, and you could check for its existence or value from within Access, to have positive evidence that the process has completed? That is, if you don't want to use ShellAndWait.
 
Thank you for the response. Unfortunately editing the VBS script is not an option, I have to get the code to do what I need it to do within the database. If I can see what the code would be to have Access run the hyperlink associated with a control, in this case, a text box, I believe I'll be able to complete this task as the other 2 parts are working correctly. I'm just not sure of the proper syntax or which method I should be using: Hyperlink.Follow, Hyperlink Object Members, Hyperlink.Address Property, etc TIA
 

Users who are viewing this thread

Back
Top Bottom