[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Want to connect Access 2007 to SQL Server 2008

Posted on 2011-09-09
3
Medium Priority
?
285 Views
Last Modified: 2012-05-12
Hi Everybody,

I am trying to connect my Access 2007 database to a SQL Server  2008 database. I have tried the following string that I found, but it is not working.
---------------------------------------------------------------------------------------------------
Private Sub Command0_Click()

Dim MyConnObj As New ADODB.Connection    <--- Problem highlighted in yellow here
Dim myRecSet As New ADODB.Recordset
Dim sqlStr As String

MyConnObj.Open _
 "Provider = sqloledb;" & _
 "Data Source=timvmsql1;" & _
 "Initial Catalog=TESTWORLD;"


   sqlStr = "select * from contacts"

   myRecSet.Open sqlStr, MyConnObj, adOpenKeyset

   MsgBox "Total Number of records = " & myRecSet.RecordCount


End Sub
---------------------------------------------------------------------------------------------

It does not seem to recognize the ADODB functionality. Is there somewhere that I need to enable this functionality or is there another method?  Perhaps DAO?

Thanks,
0
Comment
Question by:jonsuns7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 36514349
Do you have the ADO library loaded as a reference in your VBE?

Tools-->References-->
0
 

Author Closing Comment

by:jonsuns7
ID: 36514969
I had figured out the answer, that was the same as you mentioned. But since nobody else answered, I'll give you the points. Have a good weekend.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36515010
ok
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question