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.

Count Access Records

 Keywords:  Count Access Records

Question:

I can open an access database but how can I count the records?
AccessDB = ObjectOpen("Access.Application")
ADB = AccessDB.Application
ADB.OpenCurrentDatabase("c:\1.mdb")
ADB.Visible = @TRUE
ADB.UserControl = @TRUE
ADBCmd = ADB.docmd
ADBCmd.OpenTable("Table1")

Answer:

Try the RecordCount() method.

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:\wbdemo\blank.mdb")
RS= db.OpenRecordSet("RAO")

nCnt = RS.RecordCount()
message("Records in Table",nCnt)

RS.Close()
db.Close()
ObjectClose(RS)
ObjectClose(db)
ObjectClose(ws)
ObjectClose(Dao)
exit



Article ID:   W14687
Filename:   Count Access Records.txt
File Created: 2003:02:03:15:43:18
Last Updated: 2003:02:03:15:43:18