![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | strPathtoMDB path changed from mdb to the System file(runtime error) I have one test script that works so I know all the paths are right and the workgroup file works and the passwords allow the script to run. I would like to use my script below instead because it has error checking, messages for the user & copies the file before compacting. It is a split database and I only want to compact the backend. That is why I have to open the system workgroup file not the mdb file. The first script doesn't work if I change the 2nd line to the mdb file. set dbe = createobject("dao.dbengine.36") dbe.SystemDB="Z:\SwimClub\System.mdw" dbe.DefaultUser = "Brian" dbe.DefaultPassword ="Kiyote#3" dbe.CompactDatabase "Z:\SwimClub\acsc_be.mdb","Z:\SwimClub \compact_acsc_be2.mdb",,,";pwd=Kiyote#3" So I changed the strPathtoMDB variable to the SYSTEM workgroup file, not the mdb file, on the first line of code below. The script doesn't work. I get the error 'Runtime error object doesn't support this property or method "default user" '. So this script below won't accept the System.mdw file to check for the user and password when the one above does? Is the strPathtoMDB a hardwired variable? So is this script below only going to accept the mdb file as the connection not the System.mdw file for some reason or can I change it someway. Tnx, Option Explicit Dim objScript Dim objAccess Dim strPathToMDB Dim strMsg Dim strTempDB strPathToMDB = "Z:\SwimClub\SYSTEM.mdb" strTempDB = "Z:\SwimClub\Comp0001.mdb" Set objAccess = CreateObject("Access.Application.11") objAccess.DefaultUser = "BRIAN" objAccess.DefaultPassword = "Kiyote#3" On Error GoTo 0 objAccess.DBEngine.CompactDatabase strPathToMDB, strTempDB If (Err.Number <> 0) Then On Error GoTo 0 ' strMsg = "The following error was encountered while compactingdatabase:" strMsg = strMsg & vbCrLf & vbCrLf & Err.Description Call MsgBox(strMsg) Wscript.Quit End If On Error GoTo 0 ' Create File System Object to handle file manipulations Set objScript = CreateObject("Scripting.FileSystemObject") ' Back up the original file as Filename.mdbz. In case of undetermined ' error, it can be recovered by simply removing the terminating "z". objScript.CopyFile strPathToMDB, strPathToMDB & "z", True ' Copy the compacted mdb by into the original file name objScript.CopyFile strTempDB, strPathToMDB, True ' We are finished with TempDB. Kill it. objScript.DeleteFile strTempDB Call MsgBox("compact successful") |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Windows installer - Error: 80070641 and Error 3: System cannot find path specified | Windows Updates | |||
| Windows installer - Error: 80070641 and Error 3: System cannot find path specified | General Discussion | |||
| Re: VBScript runtime error: Variable is undefined: 'System' | VB Script | |||
| System file COMCTL32.OCX changed inadvertantly | Vista General | |||