Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: ACCESS Table or Query Exists
Might be useful as a subroutine in a larger data access system.
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
Stan Littlefield
BTI
;//////////////////////////////////////////////////////////////////////////////// ; Obtain Information For MS ACCESS Database ; Takes 3 parameters - 1 - Full Path to MDB File ; 2 - table or querydef name - Not case Sensitive ; 3 - mode where 1=Table 2=Query ; Example ; istable C:\TEMP\TEMP.MDB Contacts 2 - searches for query named Contacts ;//////////////////////////////////////////////////////////////////////////////// IF IsDefined(param1)==@NO message("Complete Path/File of Access Database Missing"," for example - C:\TEMP\TEMP.MDB") exit Else If FileExist("%param1%") == 0 message("Doesn't Exist or path is Invalid","Cannot Locate %param1%") exit Endif Endif IF IsDefined(param2)==@NO message("Parameter Missing","Table or Query You Are Looking For") exit Else param2 = StrUpper(param2) Endif IF IsDefined(param3)==@NO param3 = 1 ; default to Table Else param3 = Int(param3) Endif If param3==1 cVar = "Table" Else cVar = "Query" Endif msg = "Searching For %cVar% %param2%" dao = objectopen("DAO.DBEngine.35") ws = dao.CreateWorkspace("JetWorkspace", "admin", "") db = ws.OpenDatabase("%param1%") IsFound =@FALSE msg1 = "Sorry, Not Found" tbl = db.%cVar%Defs ; handles either TableDefs or QueryDefs x=tbl.Count FOR i= 0 TO x-1 ivar = db.%cVar%Defs(i) tname = ivar.Name If StrUpper(tname)=="%param2%" IsFound=@TRUE msg1 = "%param2% Was Found" break Endif NEXT message(msg,msg1) objectclose(db) objectclose(ws) objectclose(dao) exit
Article ID: W14330
Filename: ACCESS Table or Query Exists.txt
File Created: 2003:02:03:15:42:50
Last Updated: 2003:02:03:15:42:50