Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: opentable method
MyDB = ObjectOpen("Access.Application") dbname = "c:\temp\access.mdb" ;MyDB.visible = 1 MyDB.visible = @true MyDB.usercontrol = 1 MyDB.OpenCurrentDatabase(dbname) MyDB.DoCmd.Openform "System" myform = MyDB.Forms(0) MyDB.DoCmd.openform myform myform = "Test" MyDB.DoCmd.openform myform,,,,, ;message("",myform) message("MS Access","Close Access") ;timedelay(3) ;ObjectClose(MyDB)
With DAO you often need to open a DAO Workspace Object - then set your database and table objects from the DAO workspace.
>MyDB.DoCmd.Openform "System"Second, the above syntax is improper for Winbatch; you need to first open the DoCmd Object
oAPP = MyDB.Application Cmd = oAPP.DoCmdThen hopefully you can call
Cmd.OpenForm( "System" )but you are probably better off with: Cmd.RunMacro( "my macro" ) which opens the form and does other processing... just a thought...
Here is one example that uses the 'OpenTable' method to open an access table.
db = "c:\Temp\Test.Mdb" tablename = "NameTable" column1 = "FirstName" column2 = "LastName" val1 ="Fred" val2 = "Flintstone" if !FileExist(db) message("Error","Database file doesn't exist") exit endif AccessDB = ObjectOpen("Access.Application") ADB = AccessDB.Application ADB.OpenCurrentDatabase(db) ADB.Visible = @TRUE ADBCmd = ADB.docmd ErrorMode(@off) ADBCmd.OpenTable(tablename) Errormode(@cancel) if lastError() == 1261 ;need to create the table SQLstmt = StrCat("CREATE TABLE ",tablename," (",column1," CHAR, ",column2," CHAR)") ADBCmd.RunSQL(SQLstmt ) endif SQLstmt = StrCat('INSERT INTO ',tablename,' (',column1,',',column2,') VALUES ("',val1,'","',val2,'")') ADBCmd.RunSQL(SQLstmt ) acTable = 0 acSaveYes = 1 ADBCmd.Close(acTable, tablename, acSaveYes) ADBCmd.Quit ObjectClose(adbcmd) ObjectClose(adb) ObjectClose(accessdb)
Article ID: W15248
File Created: 2002:09:05:13:50:50
Last Updated: 2002:09:05:13:50:50