To All
Ran into some VB code on creating a MS Access database from code .. which seemed fairly straight forward :
However, translating the code I get an error at the Server:CreateObject("ADOX.Catalog") line
Here is my code .. any help would be appreciated ..
Rick Lipkin
Ran into some VB code on creating a MS Access database from code .. which seemed fairly straight forward :
Sub CreateAccessDatabase(sDatabaseToCreate)
Dim catNewDB ' As ADOX.Catalog
Set catNewDB = Server.CreateObject("ADOX.Catalog")
catNewDB.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDatabaseToCreate & _
";Jet OLEDB:Engine Type=5;"
' Engine Type=5 = Access 2000 Database
' Engine Type=4 = Access 97 Database
Set catNewDB = Nothing
End SubHowever, translating the code I get an error at the Server:CreateObject("ADOX.Catalog") line
Application
===========
Path and name: C:\Fox\Rick\Access.Exe (32 bits)
Size: 1,873,920 bytes
Time from start: 0 hours 0 mins 4 secs
Error occurred at: 11/19/11, 10:13:29
Error description: Error BASE/1003 Variable does not exist: SERVER
Args:Here is my code .. any help would be appreciated ..
Rick Lipkin
#include "FiveWin.ch"
//-------------
Func Main()
Local catNewDB,xProvider,cFile,aDir,dExe,cDefa,mStart
//-- get timestamp on .exe //
cFILE := GetModuleFileName( GetInstance() )
aDIR := DIRECTORY( cFILE )
dEXE := aDIR[1] [3]
// where .exe started from is default directory //
mSTART := RAT( "\", cFILE )
cDEFA := SUBSTR(cFILE,1,mSTART-1)
aDIR := NIL
SET DEFA to ( cDEFA )
xPROVIDER := "Microsoft.Jet.OLEDB.4.0"
xSOURCE := cDEFA+"\Rick.mdb"
catNewDB := Server:CreateObject("ADOX.Catalog") // errors here on Server
catNewDB:Create('Provider='+xProvider+';Data Source='+xSource+';Jet OLEDB:Engine Type=5' )
Return(nil)