uploading a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I have a big Access databse on a Internet Service Porvider sever, and I
need to add a strored query, is it possible to upload jjst this query
without uploading the whole database?
 
If your web server supports ASP, you could create and execute a VB script
to create your query. It would use code like this ...


Dim objAccess
Dim strPathToMDB
Dim strFilePath

Dim strModuleName
Dim mdl
Dim strCode
Dim objScript
Dim objFile

Const acModule = 5

' ///////////// NOTE: User must edit variables in this section /////////////////
'
' The following 3 lines of code are the only variables that need be edited
' Provide paths to the Access MDB, Text file for import and the new table name.
'
strPathToMDB = "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
strFilePath = "C:\ModuleCode.txt"
strModuleName = "Startup"
'
' ///////////////////////////////////////////////////////////////////////////////

' Create Access 97 Application Object
'Set objAccess = CreateObject("Access.Application.8")

' For Access 2000, use Application.9
Set objAccess = CreateObject("Access.Application.9")

' Open the desired database
objAccess.OpenCurrentDatabase(strPathToMDB)

Dim dbs, qdf
Set dbs = objAccess.DBEngine(0)(0)
Set qdf = dbs.CreateQueryDef("qryName", strSQL)
dbs.QueryDefs.Append qdf

' Clean up Access App Object
objAccess.CloseCurrentDatabase
ObjAccess.Quit
Set objAccess = Nothing
 
Ooops. Let me simplify that a little by deleting the references to modules.
The original code was to export a module to a text file.

Dim objAccess
Dim strPathToMDB

' ///////////// NOTE: User must edit variables in this section /////////////////
'
' The following 3 lines of code are the only variables that need be edited
' Provide paths to the Access MDB, Text file for import and the new table name.
'
strPathToMDB = "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
'
' ///////////////////////////////////////////////////////////////////////////////

' Create Access 97 Application Object
'Set objAccess = CreateObject("Access.Application.8")

' For Access 2000, use Application.9
Set objAccess = CreateObject("Access.Application.9")

' Open the desired database
objAccess.OpenCurrentDatabase(strPathToMDB)

Dim dbs, qdf

Set dbs = objAccess.DBEngine(0)(0)
Set qdf = dbs.CreateQueryDef("qryName", strSQL)
dbs.QueryDefs.Append qdf

' Clean up Access App Object
objAccess.CloseCurrentDatabase
ObjAccess.Quit
Set objAccess = Nothing
 
Back
Top