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 with Access

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

Open Access DB with DAO

Keywords: 	 Open Access DB with DAO

Question:

THe Access window keeps popping up with this code, how do I prevent it from poppin up? Thanks for your time.
:startAccess
dbname = "C:\temp\StorageTest.mdb"
accessDB = objectopen("Access.Application")
ADB = accessDB.Application
ADB.OpenCurrentDatabase(dbname)
ADB.Visible = @false 
ADB.UserControl = @false
db = accessDB.currentdb
return

Answer:

Use DAO (Data Access Objects) or ADO (Active Data Objects).

These allow you to query a MS Access database without the Access Application.

Or, if you like alot of coding, use the ODBC extender :(

Make sure DAO.DBEngine.35 exists on those computers. Maybe try searching the registry for that application object. Search under HKEY_Classes_Root for

DAO.DBEngine....

And make sure that version 3.5 (35 above) is installed. Open up the registry editor on the PC and do a search for:

DAO.DBEngine

If it's installed it will show up as: DAO.DBEngine.35


dao = objectopen("DAO.DBEngine.35")

ws = dao.CreateWorkspace("JetWorkspace", "admin", "")
db = ws.OpenDatabase("c:\data\access\survey template.mdb")

;sqlstr = "delete * from Eaprint;"

;db.execute(sqlstr)
rs = db.openrecordset("User Information")

uname = rs.fields("user_id")

message("User", uname.value)

objectclose(rs)

objectclose(db)
objectclose(ws)
objectclose(dao)

message("Debug", "End of Job")

exit

Article ID:   W15619
File Created: 2003:05:13:11:29:16
Last Updated: 2003:05:13:11:29:16