Can VBScript be used to import data into MS Access? I have searched the web
and have not been able to find anything.
If someone could point me in the right direction, I would appreciate it.

Thanks

Re: Import Access DB by Bob

Bob
Sat Mar 12 03:43:33 CST 2005

TenStar wrote:
> Can VBScript be used to import data into MS Access? I have searched
> the web and have not been able to find anything.
> If someone could point me in the right direction, I would appreciate
> it.
>
> Thanks

You have several options:

1. Automate Access using the createobject method to instantiate an access
Application object which can use the DoCmd method to run the
TransferDatabase method. See Access online help for details (or do a Google
search). You'll probably find code examples written in VB/VBA like:
dim obj as new access.application
obj.OpenCurrentDatabase "p:\ath\to\database.mdb"
etc.

To convert it to vbscript, remember that all variables are variants in
vbscript, so:

dim obj
set obj=createobject("access.application")
etc.

2. Use ADO - since you did not provide details avout what type of data you
are importing, I can't get more specific than using ADO to read the data
from the source, and using Execute to run INSERT statements to insert the
data into the database.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



RE: Import Access DB by JD

JD
Sat Mar 12 06:23:01 CST 2005

Ya...You can import data into MS access using .vbs file

Please copy and paste the below code into a notepad and save the file as
"MyScript.vbs. Double click on the file to execute. For this script I have
used MS Access 2000.

'###########################
' VBScript source code

Dim Cn
set cn= CreateObject("ADODB.Connection")
' In the connection string you provide the Full path of the Access File
cn.ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="MyDB.mdb"
msgbox (cn.Version)
set cn = nothing

'########################################

Hope this will drive you.

Bye
JD






"TenStar" wrote:

> Can VBScript be used to import data into MS Access? I have searched the web
> and have not been able to find anything.
> If someone could point me in the right direction, I would appreciate it.
>
> Thanks
>
>
>