Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 17th, 2004, 04:21 PM
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default DAo & ADO & connectionstring

Hello, i'm in big troubel. please help me !!

I'm working on access XP, and my database is on SQL server.
I have migrated my access database to SQL using a DSN configurated with configuration tools on windows.

But If I delete my DSN, i could see anymore my tables.

I try to make a connection with connectionstring with windows security login, and it works. But i can't anymore see my tables.

Moreover, when i try to run my querys or my macros (using DAO.recordset), it doesn't work...

So, i would like to know :
- Is an ADO connection is compatible with DAO code to access the tables ?
- How can i see my tables in access without a DSN ?

HELP ME !!!!!!!!!!!!! PLEASE

 
Old November 17th, 2004, 04:44 PM
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm in hurry.. so help me..

 
Old November 17th, 2004, 04:55 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I can answer the second question: You can't. You need a system DSN in order for you to connect to your SQL server - this is true whether you are using Access or any other application.

These connections go to your ODBC data in the registry for information on how to connect. If that data is not there, then your apps won't know where to go for the connection.

When you connect your tables from Access (link or import), you need to select ODBC Data Sources as your file type. If that DSN is not in the list, then you can't get any further in making your connections.

If you made the connections and then deleted the DSN, you have to recreate it, then delete the old table references and recreate them in Access (unless it is only connected through your code.)

I hope this helps.

mmcdonal
 
Old November 17th, 2004, 05:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default

answer to Q1: No, you cannot use DAO code with an ADO connection.

answer to Q2: You can create a DSN-less connection.

cnn.Open _
"Provider= MSDASQL;Driver=SQL Server;" & _
"Server=<TheNameOfYourServer>;" & _
"Database=<TheNameOfYourSQLDatabase>;UID=sa;PW D="

You will need to replace the text between the <> with the appropriate values (do not include the < or the >). You may also need to change the UID and/or password (PWD).





Rand
 
Old November 17th, 2004, 05:03 PM
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, ,i have understood.
But my problem is :
I have got a batch which will run at time and launch an access mdb. But this access mbd won't have a DSN configuration. So i believe, i must have a connection with my database using ADO connectionstring.
Nevertheless, all the parts of my application are using DAO code, So is a ADO connection can work with a DAO code ?

 
Old November 17th, 2004, 05:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can always re-write your DAO code as ADO. In this case it may be worth the effort. If you're dealing with SELECT recordsets the changes are relatively simple to do. One of the best references I've found for this is Microsoft Access Developer's Guide to SQL Server, Mary Chipman and Andy Baron, SAMS (2000)

Rand





Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript && keeps turnig into &amp;&amp; ayrton Pro VB.NET 2002/2003 3 June 27th, 2005 03:34 PM
DAO & ADO knowledge76 Access VBA 1 January 24th, 2005 10:12 AM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM
DAO & SQL Server apoorv_gupta Pro VB Databases 0 September 18th, 2003 05:59 AM
How to connect .dbf file with ADO & DAO with code cbpanchal VB How-To 4 July 28th, 2003 10:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.