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"