Re: Database Extract Automation
From: roger (divingroom6969_at_yahoo.com)
Date: 10/13/04
- Next message: Al Blake: "Re: cant link db3 with 'wrong' extension?"
- Previous message: Mantok: "Re: Exporting to ebcdic file"
- In reply to: John Nurick: "Re: Database Extract Automation"
- Next in thread: John Nurick: "Re: Database Extract Automation"
- Reply: John Nurick: "Re: Database Extract Automation"
- Messages sorted by: [ date ] [ thread ]
Date: 12 Oct 2004 19:56:11 -0700
Thanks for your help John, I am actually almost there thanks to your
help, my only outstanding issue now, is that for some reason, the
vbscript called Sql query cannot process, a number of Access specific
functions, for instance the Nz() function, can I declare a library in
the declaration section of the script to solve this issue, if so,
would you know which library would contain, these basic functions.
thanks for your help
roger
John Nurick <j.mapSoN.nurick@dial.pipex.com> wrote in message news:<jg1gm0984bn8cktkgsoevo7snnct5pdcml@4ax.com>...
> Hi Roger,
>
> Usually it's simpler to automate the Jet database engine than to
> automate Access itself. Situations where the latter is required include
> working with forms and reports, or with queries that use functions that
> are not available in Jet.
>
> Here's some basic VBScript that opens a secured MDB and creates an
> unsecured one. You can then use the Execute method of the secured
> database to execute JET SQL statements to move the data across.
>
> Depending on the rquirements for the unsecured databases all you may
> need is to execute four make-table queries (SELECT ... INTO ...
> statements). OTOH if you need to control field sizes and create indexes,
> you'll have to execute a series of Jet SQL DDL statements to create each
> table and each index - though this is still less trouble than creating
> each field individually as you are doing in your existing code.
>
> As Jeff says, there's a case for simplifying things by creating a
> "template" unsecured mdb containing the empty tables. In that case you'd
> just open the secured mdb, make a copy of the template, and execute
> append queries to transfer the data. But it's probably a more robust
> solution if your code creates the unsecured mdb from scratch whenever
> needed.
>
> Const SystemDB = "D:\Folder\blah.mdw"
> Const SecuredDB = "D:\Folder\Secured.mdb"
> Const UnsecuredDB = "D:\Folder\Unsecured.mdb"
> Const UserName = "User"
> Const Password = "Password"
>
> Dim dbESec 'As DAO.DBEngine
> Dim dbWSec 'As DAO.Workspace
> Dim dbDSec 'As DAO.Database
>
> Dim dbE 'As DAO.DBEngine
> Dim dbDNew 'As DAO.Database
>
> Set dbESec = CreateObject("DAO.DBEngine.36")
> dbESec.SystemDB = SystemDB
> Set dbWSec = dbESec.CreateWorkspace("Secured", _
> UserName, Password, 2) '2 = dbUseJet
> Set dbDSec = dbWSec.OpenDatabase(SecuredDB)
>
> Set dbE = CreateObject("DAO.DBEngine.36")
>
> 'Add code here to make sure UnsecuredDB doesn't
> 'already exist
>
> Set dbDNew = dbE.CreateDatabase(UnsecuredDB, _
> ";LANGID=0x0409;CP=1252;COUNTRY=0")
> 'above string = dbLangGeneral
>
> 'Token manipulation of DBs to prove they're available
> Msgbox dbDSec.Name & ": " & dbESec.SystemDB _
> & Chr(13) & Chr(10) & dbDNew.Name & ": " & dbE.SystemDB
>
> 'Add code here to execute SQL statements
> 'to create tables/transfer data
>
> 'Tidy up
> dbDSec.Close
> dbWSec.Close
> dbDNew.Close
>
>
> On 7 Oct 2004 15:50:16 -0700, divingroom6969@yahoo.com (roger) wrote:
>
> >Every hour, I would like a script that does the following (in vbscript
> >cause that's the only one I am even remotely comfortable with)
> >
> >1- Extract from a secure database 4 query result tables and copy them
> >into a new unsecure database
- Next message: Al Blake: "Re: cant link db3 with 'wrong' extension?"
- Previous message: Mantok: "Re: Exporting to ebcdic file"
- In reply to: John Nurick: "Re: Database Extract Automation"
- Next in thread: John Nurick: "Re: Database Extract Automation"
- Reply: John Nurick: "Re: Database Extract Automation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|