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

Running a VB script inside an access database

Status
Not open for further replies.
Dec 17, 2003
39
0
0
US
I have created a vb script that will convert a file to text for me to import those records, but I can't seem to run it from Access. Can someone help me. here's the vb script i'm using.

Option Explicit
Dim oFSO

Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists("C:\p45\OMS\6059.sc") = True Then
oFSO.CopyFile"C:\P45\OMS\6059.sc", "C:\P45\OMS\6059.txt"
Else
'The first file was not there
WScript.Quit()
End If

If oFSO.FileExists("C:\p45\OMS\6059.txt") = True Then
oFSO.DeleteFile("C:p45\OMS\6059.sc")
Else
'There was a problem with the copy because the
'new file is not present
End If

Set oFSO = Nothing
 
ou should be able to do this easily with VBA, but if you want to stick with VBS, what errors are you getting and how are you trying to execute it?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
How are you attempting to execute the script?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
What error do you get?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Line 6, Char 3, Permission Denied when I try to run the macro that uses the following code:

RunApp wscript S:/Education/rename.vbs
 
If you open an explorer window and simply double-click on the script, what happens?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
the script works that way. I want it to execute in the access database.
 
Open a database. Create or open a module for editing. In the MS Editor, press F1 to open help. Look for help on:
Shell
FileCopy
FileSystemObject

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top