ADO-->Access 97 help, please. 
Author Message
 ADO-->Access 97 help, please.

Greetings:

I'm having a horrible time trying to connect to an Access97 .mdb file
from VB5, using ADO.  I have set up a System DSN for the file in
question.  Whenever I run my app, it chokes with the following
message:

--
Run-time error '-2147467259 (80004005)':
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
--

I have shown my code below.

Option Explicit

Public connWS As ADODB.Connection

Private Sub Form_Load()
   Set connWS = New ADODB.Connection
   connWS.ConnectionString =
"Provider=MSDASQL;DSN=DSN_name;DATABASE=Clients.mdb;UID=admin;PWD="
   connWS.Open
End Sub

======================================================================
||                      Email address is munged.                    ||
----------------------------------------------------------------------
http://www.*-*-*.com/ ;           -- Greek Discussion Groups
http://www.*-*-*.com/ ;-- YOUR Group's Discussion Board
http://www.*-*-*.com/ 're here



Thu, 05 Apr 2001 03:00:00 GMT  
 ADO-->Access 97 help, please.
Duncan:

I also had some fight, it's not clear how to do it.

If you have set a DSN for that database specifically then the
"DATABASE=" parameter shoul be ommited.

Anyway, I've found that for Access instead of DATABASE= it works
better with DBQ=.

One method is to set a FileDSN for the database and look into it with
a text editor. There you'll see the parameters.

I did it this morning while failing absolutely to set a DSNless
connection to an MDB usinf ADO from VBScript.

Good luck

Juan Lanus

Quote:

> Greetings:

> I'm having a horrible time trying to connect to an Access97 .mdb file
> from VB5, using ADO.  I have set up a System DSN for the file in
> question.  Whenever I run my app, it chokes with the following
> message:

> --
> Run-time error '-2147467259 (80004005)':
> [Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified
> --

> I have shown my code below.

> Option Explicit

> Public connWS As ADODB.Connection

> Private Sub Form_Load()
>    Set connWS = New ADODB.Connection
>    connWS.ConnectionString =
> "Provider=MSDASQL;DSN=DSN_name;DATABASE=Clients.mdb;UID=admin;PWD="
>    connWS.Open
> End Sub

> ======================================================================
> ||                      Email address is munged.                    ||
> ----------------------------------------------------------------------
> http://www.mcrae.ca/greek             -- Greek Discussion Groups
> http://www.mcrae.ca/greek/groups.htm  -- YOUR Group's Discussion Board
> http://www.mcrae.ca/greek/mission.htm -- Why we're here



Thu, 05 Apr 2001 03:00:00 GMT  
 ADO-->Access 97 help, please.
Duncan,

Please post your connection string value as well as the connection object
properties you set for your connection object.  If your going the shortcut
route with a command or recordset object, please post the connection
information for whichever relevant object your using.  It appears something
may be incorrect in the connection information you are using.

best regards,

John B.

in reply to:

Quote:

>Greetings:

>I'm having a horrible time trying to connect to an Access97 .mdb file
>from VB5, using ADO.  I have set up a System DSN for the file in
>question.  Whenever I run my app, it chokes with the following
>message:

>--
>Run-time error '-2147467259 (80004005)':
>[Microsoft][ODBC Driver Manager] Data source name not found and no
>default driver specified
>--

>I have shown my code below.

>Option Explicit

>Public connWS As ADODB.Connection

>Private Sub Form_Load()
>   Set connWS = New ADODB.Connection
>   connWS.ConnectionString =
>"Provider=MSDASQL;DSN=DSN_name;DATABASE=Clients.mdb;UID=admin;PWD="
>   connWS.Open
>End Sub

>======================================================================
>||                      Email address is munged.                    ||
>----------------------------------------------------------------------
>http://www.mcrae.ca/greek             -- Greek Discussion Groups
>http://www.mcrae.ca/greek/groups.htm  -- YOUR Group's Discussion Board
>http://www.mcrae.ca/greek/mission.htm -- Why we're here



Fri, 06 Apr 2001 03:00:00 GMT  
 ADO-->Access 97 help, please.
You don't have to specify the Provider if you are using DSN.  Use the
Microsoft Access Driver and set the Workgroup file in the DSN.
Then open the connection using connection string as usual (B) or use the
sample A below.

A. Setting the workgroup file in ADO property:

----Start Code ----
Set mConnection = New ADODB.Connection
With mConnection
  .Provider = "Microsoft.Jet.OLEDB.3.51"
  .Properties("Jet OLEDB:System database") = "d:\vb sample\dao\system.mdw"
  .Open "d:\vb sample\dao\biblio.mdb", "admin", ""
End With
----End Code ----

B. Using DSN:
1. Create a DSN with Microsoft Access Driver.
2. Select your protected database. Define the System Database to your
workgroup file.
3. Open the ADO using your DSN as usual (dont forget to define the uid and
pwd).

----Start Code ----
    With mConnection
       .ConnectionString = "uid=admin;pwd=;DSN=nwindpass;"
       .Open
    End With
----End Code ----

I include a sample DSN file below.  Change the SystemDB, DefaultDir and DBQ
to your objects.

-----Begin Cut-----
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=admin
UserCommitSync=Yes
Threads=3
SystemDB=D:\VB Sample\DAO\SYSTEM.MDW
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=512
ImplicitCommitSync=Yes
FIL=MS Access
DriverId=25
DefaultDir=D:\VB Sample\DAO
DBQ=D:\VB Sample\DAO\biblio.mdb
-----End Cut-----

You can see more samples in my Site.
www.geocities.com/siliconvalley/platform/7797/

Quote:

>Greetings:

>I'm having a horrible time trying to connect to an Access97 .mdb file
>from VB5, using ADO.  I have set up a System DSN for the file in
>question.  Whenever I run my app, it chokes with the following
>message:

>--
>Run-time error '-2147467259 (80004005)':
>[Microsoft][ODBC Driver Manager] Data source name not found and no
>default driver specified
>--

>I have shown my code below.

>Option Explicit

>Public connWS As ADODB.Connection

>Private Sub Form_Load()
>   Set connWS = New ADODB.Connection
>   connWS.ConnectionString =
>"Provider=MSDASQL;DSN=DSN_name;DATABASE=Clients.mdb;UID=admin;PWD="
>   connWS.Open
>End Sub

>======================================================================
>||                      Email address is munged.                    ||
>----------------------------------------------------------------------
>http://www.mcrae.ca/greek             -- Greek Discussion Groups
>http://www.mcrae.ca/greek/groups.htm  -- YOUR Group's Discussion Board
>http://www.mcrae.ca/greek/mission.htm -- Why we're here



Fri, 20 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ADO-->Access 97 help, please.

2. ADO: Convert Access 97 -> 2000

3. Outlook 97/98(tasks)--> Access (97)

4. Access 97->2000 HELP PLZ.

5. Access 97->2000 HELP PLZ.

6. Access 97->2000 HELP PLZ.

7. Access 97->2000 HELP PLZ.

8. PLEASE HELP with ADO and .mdb 97

9. Please Help --------->>>>AppLink Problem

10. >>>> Tab Key --- Please Help

11. vba access 97 -> access 2000

12. Access 97 -> Access 2000 VB Scope Problem

 

 
Powered by phpBB® Forum Software