WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Code to Open DB and Permit Working with Tables

Keywords:   open db and permit working with tables

This combination gives your script the capacity to get at the widest range of methods and properties.

In debugging some OLE exceptions for a script I need completed by tomorrow, I discovered something which may be helpful to others:

In order to use Methods and Properties from both the Application Object and the DBEngine Object when using OLE with Microsoft Access via Winbatch Scripts, the following is required:

oMDB = ObjectOpen("Access.Application.8")
APP = oMDB.Application
; this 'opens' the Database and permits working with tables
; from the DoCmd Object - this would allow functions like
; Cmd.TranserDatabase()
APP.OpenCurrentDatabase("E:\WBDEMO\BLANK.MDB")
Cmd = APP.docmd

; now set your object from oMDB, not APP
Dao = oMDB.DBEngine
ws = Dao.CreateWorkspace("JetWorkspace", "admin", "")

; this method does not really open the database, but sets a 'pointer'
; to it, so you can perform actions like creating queries
; qdef = db.CreateQueryDef("ccqry","SELECT ANI FROM TEMPTBL")
db = ws.OpenDatabase("E:\WBDEMO\BLANK.MDB")

Article ID:   W14909
File Created: 2001:11:08:12:40:56
Last Updated: 2001:11:08:12:40:56