473,395 Members | 1,948 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,395 software developers and data experts.

runtime error 2593

Hello folks

I am trying to use ado in an access report with no luck.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. ' Global Vars to be used through code
  3. Dim sQl As String
  4.  
  5. ' Declaire remote connection
  6. Dim rmcn As ADODB.Connection, rmrs As ADODB.Recordset
  7.  
  8. ' Create connection and open connection - remote
  9. Set rmcn = New ADODB.Connection
  10.  
  11. With rmcn
  12.     .Provider = "Microsoft.Access.OLEDB.10.0"
  13.     .Properties("Data Provider").Value = "SQLOLEDB"
  14.     .Properties("Data Source").Value = "server\sqlexpress"
  15.     .Properties("User ID").Value = "user"
  16.     .Properties("Password").Value = "password"
  17.     .Open
  18. End With
  19.  
  20. ' Open recordset and run sql
  21. Set rmrs = New ADODB.Recordset
  22.  
  23. sQl = "SELECT * FROM link.db.dbo.table where field 'value';"
  24.  
  25. With rmrs
  26.     Set .ActiveConnection = rmcn
  27.     .Source = sQl
  28.     .LockType = dbOpenDynaset
  29.     .CursorType = adOpenKeyset
  30.     .Open
  31.  
  32. End With
  33. Set Me.RecordSource = rmrs
  34.  
  35.  
  36. End Sub
There is nothing wrong with accessing the database but trying to set the record source of the report just doen't work

Any thought?
May 25 '07 #1
4 2285
Rabbit
12,516 Expert Mod 8TB
Hello folks

I am trying to use ado in an access report with no luck.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. ' Global Vars to be used through code
  3. Dim sQl As String
  4.  
  5. ' Declaire remote connection
  6. Dim rmcn As ADODB.Connection, rmrs As ADODB.Recordset
  7.  
  8. ' Create connection and open connection - remote
  9. Set rmcn = New ADODB.Connection
  10.  
  11. With rmcn
  12.     .Provider = "Microsoft.Access.OLEDB.10.0"
  13.     .Properties("Data Provider").Value = "SQLOLEDB"
  14.     .Properties("Data Source").Value = "server\sqlexpress"
  15.     .Properties("User ID").Value = "user"
  16.     .Properties("Password").Value = "password"
  17.     .Open
  18. End With
  19.  
  20. ' Open recordset and run sql
  21. Set rmrs = New ADODB.Recordset
  22.  
  23. sQl = "SELECT * FROM link.db.dbo.table where field 'value';"
  24.  
  25. With rmrs
  26.     Set .ActiveConnection = rmcn
  27.     .Source = sQl
  28.     .LockType = dbOpenDynaset
  29.     .CursorType = adOpenKeyset
  30.     .Open
  31.  
  32. End With
  33. Set Me.RecordSource = rmrs
  34.  
  35.  
  36. End Sub
There is nothing wrong with accessing the database but trying to set the record source of the report just doen't work

Any thought?
The recordsource can't be set to a recordset, it has to be set a table/query or in this case, the SQL string.
May 25 '07 #2
NeoPa
32,556 Expert Mod 16PB
As Rabbit says, you can't set it to a connection.
Click in the RecordSource part of 'Set Me.RecordSource = rmrs' and press F1 and the Help will explain that the attribute is not an object but a string variable (& how you can use it).
May 26 '07 #3
I think i am going to have to create a local table with the data that i have just queried and use that as a datasource.
May 30 '07 #4
NeoPa
32,556 Expert Mod 16PB
I think i am going to have to create a local table with the data that i have just queried and use that as a datasource.
You say that you've just queried the data. Is it not possible to use that query, or a derivative thereof, to drive the report?
May 30 '07 #5

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

Similar topics

5
by: Bob Bamberg | last post by:
Hello All, I have been trying without luck to get some information on debugging the Runtime Error R6025 - Pure Virtual Function Call. I am working in C++ and have only one class that is derived...
5
by: Nathan Bloom | last post by:
Hi, I have a secured database that runs fine on the computer the database is installed on. I have several workstations with access runtime installed that also need access to the database. ...
2
by: Paul | last post by:
I'm hoping someone can help me with the problem. I have a database where the default value for a date field in a table is =date() This works perfectly in my table and on my form. But when I...
12
by: Markus Ewald | last post by:
I'm just experimenting around with the VisualC++ 2005 Express Edition Beta and found some strange behavior for which I can't seem to find a workaround. What I've done is set up two static library...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
0
by: zfraile | last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss' machine, not my development machine. I believe the error is generated from a call to an Excel object, but I can't tell...
0
by: Yelena Varshal via AccessMonster.com | last post by:
Hello We have a shortcut for our MS ACCESS application that uses a /Runtime switch because we may have some users that use Runtime. The application worked fine in Access 2000 and was tested with...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
3
by: Jim Armstrong | last post by:
Hello all - This is driving me crazy. I have a table called tblClients - very simple, has the following fields: taxID (PK) ClientName SalesName The main form of my application allows a...
1
by: BL3WC | last post by:
Hi, I'd created a MDE under Access 2003. It is now under testing stage. Some of the users will use Access 2003 runtime and some will use Access 2007 runtime to run this MDE. I installed the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.