If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > VBS Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-21-11, 16:25
caseyd1911 caseyd1911 is offline
Registered User
 
Join Date: Dec 2011
Posts: 4
VBS Error

I am writing a vbs to open access and clone the file for each user, as to avoid some of the lock errors. However, I have hit a roadblock. Access will open, and it will save the new file with the username, but it doesn't open the database, and I keep receiving this error: "The command line you used to start Microsoft Access contains an option that Microsoft Access doesn't recognize." I can not seem to figure out what is causing this error.
Reply With Quote
  #2 (permalink)  
Old 12-23-11, 05:07
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,264
Quote:
I can not seem to figure out what is causing this error.
given the lack of information, no idea of the script you are running or the options you are starting Access neither can we

my guess would be that you are not supplying the right parameters to start Access. it could be because there is a space in say a filename. but as said above thats a guess as you haven't provided any information to go on
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 12-27-11, 15:54
caseyd1911 caseyd1911 is offline
Registered User
 
Join Date: Dec 2011
Posts: 4
My VBS

I do have spaces in the file name, and the path. I've tried a couple of different solutions to get around the spaces to no avail. Here is what I have:


Set WshNetwork = CreateObject("WScript.Network")
GetUser = WshNetwork.UserName
Set WshNetwork = Nothing


LUName = "S:\CP_Students\2011\Fall 2011\Cory Colin\CSI Registrants2011-12\CSI REGISTRANTS.accdb"


oldname = LUName


newName = Replace(LUName, ".accdb", "") & GetUser & ".accdb"

retval = 0
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")


retval = objFSO.CopyFile(oldname, newName, True)

Set objFSO = Nothing

Dim objShell
Set objShell = CreateObject("Wscript.Shell")

objShell****n "MSACCESS.exe " & newName

Set objShell = Nothing


I'm not very talented with computer language, so I've patched together some other scripts I've used to the best of my ability. This is what I've come up with, and obviously it is not correct.

Thanks
Reply With Quote
  #4 (permalink)  
Old 12-27-11, 16:26
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,264
try
LUName = "S:\CP_Students\2011\Fall20~1\CoryCo~1\CSIReg~1\CS IReg~1.accdb"
8.3 filename - Wikipedia, the free encyclopedia

to convert long file names to 8.3 format
drop any spaces, take the first 6 characters use a tilde ~ and a single digit number indicating the index of the file
the potential issue you have is

LUName = "S:\CP_Students\2011\Fall 2011\Cory Colin\CSI Registrants2011-12\CSI REGISTRANTS.accdb"
csi registrants 2011-12
csi registrants 2012-13
would both have the same initial 6 characters
csireg
one would be ~1, one ~2, Im guessing base on the age of the files creation or possibly filename.
you will run out of filenames after 9, possibly 10.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 12-28-11, 08:19
caseyd1911 caseyd1911 is offline
Registered User
 
Join Date: Dec 2011
Posts: 4
New Error

Ok, I've replaced the path with 6 characters and tilde and now it's telling me there is an error in this line:

retval = objFSO.CopyFile(oldname, newName, True)

It is no longer opening access.
Reply With Quote
  #6 (permalink)  
Old 12-28-11, 08:48
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,264
and the error message is?
the values of the variable used int he method call to the File System Object. are?



no wait, doesn't matter, I'll just get me crystal ball and scriving mirror out and I'm sure we will all be able to work out what is going wrong with your script

OK on the count of 3, lets turn the lights down low, everyone from a circle and hold hands mumbling some arcane chant and we work out the code from the thoughts of a dead programmer who intends to pass a message from the other side
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #7 (permalink)  
Old 12-28-11, 08:51
caseyd1911 caseyd1911 is offline
Registered User
 
Join Date: Dec 2011
Posts: 4
800A0035 file not found
Reply With Quote
Reply

Tags
access, clone, error

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On