Never heard of it. Could you elaborate a bit more (I'm new to the
batch world).
WScript.exe and CScript.exe are scripting hosts that come free with
Windows. The first runs in the GUI and the second has a console interface.
You can use pretty much any language you like with them -- VBScript and
JScript are built in, but there are PERL extensions too. The advantage is
that you can access real Windows structures and, for an Access programming
group, the language is very close to VBA!
Is it possible to open access (front-end, secured database)
using a batch file? Does anyone have a sample code that I
could refered to?
You can use the Shell function (I don't do this much so treat with a great
deal of caution!):-
Option Explicit
Dim strCommand ' all variables are variants!
Dim dblProcID
strCommand = "c:\office\programs\msaccess.exe " & _
"d:\folder\folder\DB.mdb " & _
"/wrkgrp \\server\share\DB.mdw"
dblProcID = WScript.Shell(strCommand)
MsgBox "Access should be running now!"
' Finished
Alternatively you could just carry out whatever you wanted to do all in the
vbs file:-
' try to open an Access workspace and use it to
dim dbe ' access dbengine
dim wks ' jet workspace
dim db ' database
Set dbe = CreateObject("DAO.DBEngine.36")
dbe.SystemDB = "d:\programming\mytemp.mdw"
Set wks = dbe.CreateWorkspace("AddEric", _
"practice", "practice password", 2)
set db = wks.OpenDatabase("d:\programming\vbscript\practise.mdb")
' manual error trapping here
on error resume next
' do a command
db.Execute _
"INSERT INTO Test (FullName, Age) " & _
"VALUES ('Eric', 3.5)", _
128 ' dbFailOnError
if err.number <> 0 Then
' there was a problem
MsgBox "The update did not work!"
WScript.Quit 3
End if
' normal exit
WScript.Quit 0
Well, that should give you the idea. Best wishes
Tim F