473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Setting up a recordset - How do I connect to a data source on a server?

Hello -

I am trying to speed up my forms by setting up a record set to get a sub-set of data out of several very large ODBC-connected tables.

I am trying to follow the suggestions at
{Illegal link removed}

My code is as follows, but I am getting this error:

Run time error '-2147467259 (80004005)
ODBC--"Connection to 'InterAction Connection' failed.


"InterAction Connection" is the name of the datasource for my ODBC linked tables and requires an SQL Server login when I first load the database.

How do I set up the connection so that I can pass the password (or set up an input box for the password ) so that I can connect to the linked ODBC tables?

Interestingly, I still get this error even when I am connected and have already entered the SQL password when I started the database.

My full code is:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim conn As New ADODB.Connection
  3. Dim rst As New ADODB.Recordset
  4. Dim strg As String
  5. strg = "Provider=Microsoft.ACE.OLEDB.12.0;" _
  6.         & " Data Source=\\Tortaxfs01\market\WorkFlows\US_IMI_Visits\TEST_Recordset_US_IMI_Tracker.accdb;" _
  7.         & " Persist Security Info=False"
  8. conn.Open strg
  9. Dim strsql As String
  10. strsql = "SELECT dbo_INT_AUX_DIR_LIST.LISTING_ID, q_FolderList.DIRECTORY_NM" _
  11.         & " FROM (dbo_INT_AUX_LISTING LEFT JOIN dbo_INT_AUX_DIR_LIST " _
  12.         & " ON dbo_INT_AUX_LISTING.LISTING_ID = dbo_INT_AUX_DIR_LIST.LISTING_ID) " _
  13.         & " LEFT JOIN q_FolderList " _
  14.         & " ON dbo_INT_AUX_DIR_LIST.CONTAIN_DIR_ID = q_FolderList.DIRECTORY_ID" _
  15.         & " WHERE (((q_FolderList.DIRECTORY_NM) Not LIKE '*" & "firm lawyers" & "*' " _
  16.         & " And (q_FolderList.DIRECTORY_NM) Not LIKE '*" & "Companies (Public)" & "*') " _
  17.         & " AND ((dbo_INT_AUX_LISTING.LISTING_TYP_IND)=1))" _
  18.         & " ORDER BY dbo_INT_AUX_DIR_LIST.LISTING_ID "
  19.  
  20. rst.ActiveConnection = conn
  21.  
  22. 'to open a recordset a source (strsql) and an ActiveConnection(conn) are provided.
  23.  
  24. rst.Open strsql, conn
  25.  
  26. MsgBox ("open")
  27.  
  28. Set rst = Nothing
  29. Set conn = Nothing
  30.  
  31. End Sub
Much appreciated,
Sandra
Jan 25 '12 #1
1 1653
patjones
931 Expert 512MB
Hi,

It looks like you're trying to connect to an Access back end, which in turn contains linked tables to SQL Server.

Have you considered linking to the SQL Server tables directly from your front end? In this way, you can initialize a DAO recordset (for instance) using your SQL string just as you would with any local tables.

Pat
Jan 25 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Davis | last post by:
To connect the ASP application to data source, we can use ADO.Connection object Const connectionString = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=C:\mydatabase.mdb;" Dim objConn Set...
8
by: James | last post by:
I've been having this recurring General Network Error problem and I've been looking to solve it. Reboot fixes the problem for several hours, but eventually it happens again. Nothing seems to...
1
by: lytung | last post by:
Hi All, I have been struggling with this problem for quite some time. Basically i have an asp page (on the ISP server) that I want to connect to a sql server on another machine (on my server)...
3
by: ebrastow | last post by:
Hi folks, I'm a VB newbie - been using PowerBuilder for 12 years and thought I'd see how Visual Basic has come along these days. I'm using MS Visual Studio 2005 Professional, trying to connect...
3
by: D | last post by:
Hello everyone I have developed a web application using .asp to access a data source on a different server than where my .asp files are stored. I've tried to determine how to establish this...
0
by: padhuwork | last post by:
Hi, I want to create a Windows DLL using VC++ 6.0 which connects to SQL Server. After establishing the connection, I want to retrieve records from table (query) and out put the recordset to a...
2
by: Priyavenkat | last post by:
i am using VB 6.0, MS Access as backend and Crystal Reports 10 for reports. I connect data source to Crystal Reports 10 using ODBC dsn. It works correctly in my PC. When it is distributed to another...
10
by: dfarney | last post by:
So I've created a Windows based application in C# that uses data from our databases on a service provider (crystaltech). The application has been deployed and has been working great on all our...
1
by: steven_nospam at Yahoo! Canada | last post by:
I am a UNIX person (not much experience with MS Access) who during a recent upgrade on an IBM RS/6000 server had to convert our system due to an upgrade to a new software revision. The old...
3
by: macraig491 | last post by:
Hello, I have created several pivot tables using external data for which I had to set up a new data source. The data source is a Microsoft Access database. I'm encountering a problem when trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.