Hello,

does anyone know how to connect to a acces database.
For testing purpose I created an access db that is located on my desktop.

I'd like to connect to and edit the table.

Here is a small sample of the code I use but I can't connect. :(
=================================================
Dim oCmd, oCtn

Set oCmd = CreateObject ("ADODB.Command")
Set oCtn = CreateObject ("ADODB.connection")
oCtn.connectionString = "Provider=MSDAORA;Persist Security Info=False;Data
Source=testEUData Source=DSN; User ID=uid; Password=pwd;"
oCtn.open
===================================================

The point is MSDAORA is not for accessing Access table but for Oracle so
it's obvious it wouldn't work that way, but I can't find the proper module to
access an MS-Access Database. so I tried most of the modules listed on my PC.

It'd be nice if someone could help.

Regards.

Re: Connect to acces database with .vbs by Dave

Dave
Mon Jan 02 10:38:14 CST 2006

Try one of these;

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet
OLEDB:Database Password=MyDbPassword;"

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User
Id=admin;Password=;"

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Deephazz" wrote:
| Hello,
|
| does anyone know how to connect to a acces database.
| For testing purpose I created an access db that is located on my desktop.
|
| I'd like to connect to and edit the table.
|
| Here is a small sample of the code I use but I can't connect. :(
| =================================================
| Dim oCmd, oCtn
|
| Set oCmd = CreateObject ("ADODB.Command")
| Set oCtn = CreateObject ("ADODB.connection")
| oCtn.connectionString = "Provider=MSDAORA;Persist Security Info=False;Data
| Source=testEUData Source=DSN; User ID=uid; Password=pwd;"
| oCtn.open
| ===================================================
|
| The point is MSDAORA is not for accessing Access table but for Oracle so
| it's obvious it wouldn't work that way, but I can't find the proper module
to
| access an MS-Access Database. so I tried most of the modules listed on my
PC.
|
| It'd be nice if someone could help.
|
| Regards.



RE: Connect to acces database with .vbs by Deephazz

Deephazz
Wed Jan 04 02:51:02 CST 2006


I tried this :

============================================================

Dim objcmn,objcmd,lig
Set objcmd = CreateObject ("ADODB.Command")
Set objcmn = CreateObject ("ADODB.connection")
objcmn.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=path\file.mdb;Jet OLEDB:Database "'Password=MyDbPassword;"
objcmn.Open
objcmd.Activeconnection = objcmn
objcmd.commandtype = 1
objcmd.CommandText = "INSERT INTO myDatabase ([Identifier1], [[Identifier2])
VALUES (""Value1"", ""Value2")"
objcmd.Execute
==========================================================

and it worked fine !

Thanks for your help.

Regards.


Re: Connect to acces database with .vbs by Dave

Dave
Wed Jan 04 04:31:59 CST 2006

You're welcome.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Deephazz" wrote:
|
| I tried this :
|
| ============================================================
|
| Dim objcmn,objcmd,lig
| Set objcmd = CreateObject ("ADODB.Command")
| Set objcmn = CreateObject ("ADODB.connection")
| objcmn.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
| Source=path\file.mdb;Jet OLEDB:Database "'Password=MyDbPassword;"
| objcmn.Open
| objcmd.Activeconnection = objcmn
| objcmd.commandtype = 1
| objcmd.CommandText = "INSERT INTO myDatabase ([Identifier1],
[[Identifier2])
| VALUES (""Value1"", ""Value2")"
| objcmd.Execute
| ==========================================================
|
| and it worked fine !
|
| Thanks for your help.
|
| Regards.
|