Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 15th, 2007, 10:03 AM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default MS Access to SQL server connection

Hi,

I have an Access app split between front and and backend - and I've just upsized my Access backend to SQL server - and I've linked the tabled to my Access front end.

I'm a bit confused now - in my Access front end I have my original connection as follows:

SET db = ws.opendatabase("XXXX.mdb", False, False, "MS Access:PWD=")

Now that my data is on SQL Server how do I set db to point to SQL server. I refernce db throughout my code.

Thanks for any help,

Ian
Reply With Quote
  #2 (permalink)  
Old February 16th, 2007, 08:36 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

It sounds like you were using DAO. DAO does not work with SQL Server. You will have to convert your code to ADO.

Are these tables linked or remote?

mmcdonal
Reply With Quote
  #3 (permalink)  
Old February 16th, 2007, 11:11 AM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I'm using DAO - it's an app that's quite old - and the tables are linked.

Reply With Quote
  #4 (permalink)  
Old February 16th, 2007, 01:59 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You will need to use ADO. If the tables are linked, it sounds like you are using a DSN. So you will need to make sure that the DSN is installed on each workstation.

Do this to talk to your local data with code (otherwise just make everything bound to tables and queries):

Dim rs As ADODB.Recordset
Dim sSQL As String

sSQL = "SELECT * FROM tblCustomers"

Set rs = New ADODB.Recordset
rs.Open sSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic

This will allow you to do most of the work with the SQL tables.

HTH

mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
can to link a ms access table to sql server? sugar SQL Server 2000 6 May 23rd, 2006 11:45 AM
how to convert ms access db to sql server method SQL Server 2000 1 March 11th, 2005 11:44 PM
No connection to sql server, Access and excel Dorenbos BOOK: ASP.NET Website Programming Problem-Design-Solution 1 March 22nd, 2004 12:53 AM



All times are GMT -4. The time now is 11:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.