473,405 Members | 2,310 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,405 software developers and data experts.

Persisting a recordset

JustJim
407 Expert 256MB
Having just re-read Adezii's article on the above subject, I thought I'd have a play.

I think there must be a "Reference" that I need to set to use ADODB.Recordset? Otherwise I get a "User-defined type not defined" error.

Jim
Oct 15 '07 #1
7 1856
nico5038
3,080 Expert 2GB
Try the "Microsoft AcitveX Data Objects" library.
It's selected by default from A2000 or A2003...

Nic;o)
Oct 15 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Having just re-read Adezii's article on the above subject, I thought I'd have a play.

I think there must be a "Reference" that I need to set to use ADODB.Recordset? Otherwise I get a "User-defined type not defined" error.

Jim
You need a reference to ...

Microsoft ActiveX Data Objects 2.X library
Microsoft ADO Ext. 2.X for DDL and Security
Oct 15 '07 #3
JustJim
407 Expert 256MB
You need a reference to ...

Microsoft ActiveX Data Objects 2.X library
Microsoft ADO Ext. 2.X for DDL and Security
Thank you both. (Each individually and together (Dang 20 character limit))

Jim
Oct 15 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Thank you both. (Each individually and together (Dang 20 character limit))

Jim
You're welcome.
Oct 15 '07 #5
JustJim
407 Expert 256MB
Having just re-read Adezii's article on the above subject, I thought I'd have a play.

<Snip>

Jim
OK, I'm all Referenced up and playing, one of the immediate uses I thought of was to store a recordset as it was at a particular date and then re-use it even if the data in the database had changed.

when I try the following...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim rsSample As ADODB.Recordset
  3. Dim strFile As String
  4.  
  5. Set rsSample = New ADODB.Recordset
  6.  
  7. 'Construct a file name to use
  8. strFile = CurrentProject.Path & "\Sample.adtg"
  9.  
  10. 'Make sure the file exists
  11.   If Len(Dir(strFile)) > 0 Then
  12.      'Open the recordset from the file
  13.       rsSample.Open strFile, , adOpenDynamic, adLockOptimistic
  14.      'Reconnect the recordset to the database
  15.       rsSample.ActiveConnection = CurrentProject.Connection
  16.      'Make the recordset the recordsource of this subreport
  17.       Set Me.Recordset = rsSample
  18.   End If
  19.   rsSample.Close
  20.     Set rsSample = Nothing
  21.  
  22. End Sub
which is pretty much the code that Adezii posts (except for the cursor type) I get an error at the
Expand|Select|Wrap|Line Numbers
  1.       Me.Recordset = rsSample
line which says Error 2593, This feature is not available in an MDB.

There ain't nuffin' in the help files for the Recordset property saying it's only for an ADP. Is this a problem because of the ADODB.Recordset or am I missing something?

Jim
Oct 16 '07 #6
ADezii
8,834 Expert 8TB
OK, I'm all Referenced up and playing, one of the immediate uses I thought of was to store a recordset as it was at a particular date and then re-use it even if the data in the database had changed.

when I try the following...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim rsSample As ADODB.Recordset
  3. Dim strFile As String
  4.  
  5. Set rsSample = New ADODB.Recordset
  6.  
  7. 'Construct a file name to use
  8. strFile = CurrentProject.Path & "\Sample.adtg"
  9.  
  10. 'Make sure the file exists
  11.   If Len(Dir(strFile)) > 0 Then
  12.      'Open the recordset from the file
  13.       rsSample.Open strFile, , adOpenDynamic, adLockOptimistic
  14.      'Reconnect the recordset to the database
  15.       rsSample.ActiveConnection = CurrentProject.Connection
  16.      'Make the recordset the recordsource of this subreport
  17.       Set Me.Recordset = rsSample
  18.   End If
  19.   rsSample.Close
  20.     Set rsSample = Nothing
  21.  
  22. End Sub
which is pretty much the code that Adezii posts (except for the cursor type) I get an error at the
Expand|Select|Wrap|Line Numbers
  1.       Me.Recordset = rsSample
line which says Error 2593, This feature is not available in an MDB.

There ain't nuffin' in the help files for the Recordset property saying it's only for an ADP. Is this a problem because of the ADODB.Recordset or am I missing something?

Jim
Just subscribing for now, but I'll definately drop in later and hopefully we'll get this ironed out.
Oct 16 '07 #7
ADezii
8,834 Expert 8TB
OK, I'm all Referenced up and playing, one of the immediate uses I thought of was to store a recordset as it was at a particular date and then re-use it even if the data in the database had changed.

when I try the following...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim rsSample As ADODB.Recordset
  3. Dim strFile As String
  4.  
  5. Set rsSample = New ADODB.Recordset
  6.  
  7. 'Construct a file name to use
  8. strFile = CurrentProject.Path & "\Sample.adtg"
  9.  
  10. 'Make sure the file exists
  11.   If Len(Dir(strFile)) > 0 Then
  12.      'Open the recordset from the file
  13.       rsSample.Open strFile, , adOpenDynamic, adLockOptimistic
  14.      'Reconnect the recordset to the database
  15.       rsSample.ActiveConnection = CurrentProject.Connection
  16.      'Make the recordset the recordsource of this subreport
  17.       Set Me.Recordset = rsSample
  18.   End If
  19.   rsSample.Close
  20.     Set rsSample = Nothing
  21.  
  22. End Sub
which is pretty much the code that Adezii posts (except for the cursor type) I get an error at the
Expand|Select|Wrap|Line Numbers
  1.       Me.Recordset = rsSample
line which says Error 2593, This feature is not available in an MDB.

There ain't nuffin' in the help files for the Recordset property saying it's only for an ADP. Is this a problem because of the ADODB.Recordset or am I missing something?

Jim
You are creating and destroying a Recordset Variable (rstSample) before the Report has time to display its data. Aside from this, your mysterious Error will still appear. To complicate matters further, this code, except for declaring rstSample Globally and not closing the Recordset in the Procedure, works flawlessly in a Form's Open() Event. It seems as though it will not work within the context of a Report but don't give up hope, I'll look at it later.
Oct 16 '07 #8

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

Similar topics

0
by: Mark Carter | last post by:
Are there any good ways of persisting/depersisting a Worksheet?
2
by: Chris S. | last post by:
Out of a somewhat academic interest, I've created a rudimentary module for persisting dynamically created objects and data structures in plain Python source code. Presently, it's a little under a...
2
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own...
4
by: Dave Veeneman | last post by:
When does serializing objects make more sense than persisting them to a database? I'm new to object serialization, and I'm trying to get a feel for when to use it. Here is an example: I'm...
1
by: lim | last post by:
What is the possible error that occurs when the Page_load event is not triggered during execution. In my page there's some basic server control. Is there any loops holes?
12
by: Dave | last post by:
I'm relatively new to ASP and .NET and having trouble getting my head round this. I want to read a datset from a database, and display information from one row at a time, using a Next and a...
2
by: xenophon | last post by:
I added a Hidden Form Field to a form in the code behind. The value is being set in JavaScript client-side, but it is not persisting to the server in the PostBack. I know the value is being set...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
0
ADezii
by: ADezii | last post by:
Most Access Users realize that Recordsets, being virtual representations of a Query, Table, or SQL Statement, exist only in our PC's memory. They, and the data they contain, literally exist at one...
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...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.