473,792 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DAO.recordset

Hello,

I'm trying to debug an access project in which two kind of recordset
are used: ADODB.recordset and DAO.recordset. I'm trying to set the
whole project on DAO.recordset, but the following function does not
work:

Public Function GetRecordset(ps trCmdTxt As String, Optional
pintCursorType As CursorTypeEnum = adOpenStatic) As Recordset ' was
ADODB.recordset

On Error GoTo GetRecordset_Er r

Dim dsRecset As DAO.Recordset ' was ADODB

Set GetRecordset = Nothing
If Not CurrentProject. IsConnected Then
End If

'Set dsRecset = New DAO.Recordset ' was ADODB

'With dsRecset
' .CursorLocation = adUseClient
' .CursorType = adOpenStatic
'End With

Set GetRecordset = CurrentDb.OpenR ecordset(pstrCm dTxt)
'CurrentProject .AccessConnecti on.Execute (pstrCmdTxt)
Exit Function

GetRecordset_Er r:
Beep
MsgBox Err.Description , vbCritical, Application.Nam e
MsgBox pstrCmdTxt, vbOKOnly

End Function

Originally the problem was that I Was trying to do the following :
Set mdsMain = sbfMain.Form.Re cordsetClone
Where mdsMain is a DAO.recordset (RecordsetClone seems to return a
ADODB.recordset )

If someone could help on this, I would be very gratefull.

Marmotte_dodue

Jun 12 '06 #1
7 8371

ma***********@g mail.com wrote:
Hello,

I'm trying to debug an access project in which two kind of recordset
are used: ADODB.recordset and DAO.recordset. I'm trying to set the
whole project on DAO.recordset, but the following function does not
work:

Public Function GetRecordset(ps trCmdTxt As String, Optional
pintCursorType As CursorTypeEnum = adOpenStatic) As Recordset ' was
ADODB.recordset

On Error GoTo GetRecordset_Er r

Dim dsRecset As DAO.Recordset ' was ADODB

Set GetRecordset = Nothing
If Not CurrentProject. IsConnected Then
End If

'Set dsRecset = New DAO.Recordset ' was ADODB

'With dsRecset
' .CursorLocation = adUseClient
' .CursorType = adOpenStatic
'End With

Set GetRecordset = CurrentDb.OpenR ecordset(pstrCm dTxt)
'CurrentProject .AccessConnecti on.Execute (pstrCmdTxt)
Exit Function

GetRecordset_Er r:
Beep
MsgBox Err.Description , vbCritical, Application.Nam e
MsgBox pstrCmdTxt, vbOKOnly

End Function

Originally the problem was that I Was trying to do the following :
Set mdsMain = sbfMain.Form.Re cordsetClone
Where mdsMain is a DAO.recordset (RecordsetClone seems to return a
ADODB.recordset )

If someone could help on this, I would be very gratefull.

Marmotte_dodue


I suggest that you post the original code which you are trying to
debug, with the full description of the error that occurs, (Use <Ctrl
C> while the message box is visible and <Ctrl V> to paste the message
into your post), and the line where the error occurs.

Depending on the Version of Access/Jet, DAO recordsets may cause
problems when they are not closed explicitly. Initializing a function
as a DAO recordset could make this difficult.

This is doable but I wouldn't:

Public Function GetRecordset( _
ByVal Source As String, _
Optional ByVal RecordSetType As DAO.RecordsetTy peEnum = dbOpenDynamic)
Set GetRecordset = CurrentDb.OpenR ecordset(Source , RecordSetType)
End Function

A more common procedure is:
Public Sub IRecommend()
Dim r As DAO.Recordset
Set r = CurrentDb.OpenR ecordset("SELEC T * FROM Table1",
dbOpenDynamic)
'do some stuff with r
Set r = Nothing
End Sub

Jun 12 '06 #2
"ma***********@ gmail.com" <ma***********@ gmail.com> wrote in
news:11******** **************@ i40g2000cwc.goo glegroups.com:
Originally the problem was that I Was trying to do the following :
Set mdsMain = sbfMain.Form.Re cordsetClone
Where mdsMain is a DAO.recordset (RecordsetClone seems to return a
ADODB.recordset )


You don't way what in your function doesn't work. I suspect that the
lack of a qualified type declaration is the problem, though. You
declare it as "As Recordset" instaed of "As DAO.Recordset" which
means that which type depends entirely on the order of the
references -- it ADO is first, it will return ADO, if DAO is first,
it will return DAO.

As to recordsetclones , I thought all form-based recordsets were DAO.

In any event, when working with a recordsetclone, I never declare a
recordset variable at all, I just do this:

With sbfMain.Form.Re cordsetClone
[work with the recordset here]
End With

It's much cleaner to do it this way, seems to me, and avoids any
question of recordset variable types.

And, of course, you haven't identified what you're trying to do in
the first place. Many people reach for recordsets when they ought to
be using SQL.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 12 '06 #3
rkc
David W. Fenton wrote:
As to recordsetclones , I thought all form-based recordsets were DAO.

The only RecordsetClone I can find in Access, DAO or ADODB is a
property of Access.Form and it is always a DAO.Recordset. The object
browser does not say so. It says it's an Object, but it has properties
that only a DAO Recordset has whether there is a reference to DAO or not.

Jun 12 '06 #4
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:fS******** ***********@twi ster.nyroc.rr.c om:
David W. Fenton wrote:
As to recordsetclones , I thought all form-based recordsets were
DAO.


The only RecordsetClone I can find in Access, DAO or ADODB is a
property of Access.Form and it is always a DAO.Recordset. The
object browser does not say so. It says it's an Object, but it has
properties that only a DAO Recordset has whether there is a
reference to DAO or not.


Thanks for that -- I rather confused things by referring to the
form's recordset instead of the recordsetclone (I still do most of
my programming in A97, where there is no form recordset object
accessible to the programmer).

Can you assign an ADO recordset to a form?

If so, is the RecordsetClone of an ADO recordset a DAO recordset?
That would be very weird, if it were.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 12 '06 #5
rkc
David W. Fenton wrote:
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:fS******** ***********@twi ster.nyroc.rr.c om:

David W. Fenton wrote:

As to recordsetclones , I thought all form-based recordsets were
DAO.


The only RecordsetClone I can find in Access, DAO or ADODB is a
property of Access.Form and it is always a DAO.Recordset. The
object browser does not say so. It says it's an Object, but it has
properties that only a DAO Recordset has whether there is a
reference to DAO or not.

Thanks for that -- I rather confused things by referring to the
form's recordset instead of the recordsetclone (I still do most of
my programming in A97, where there is no form recordset object
accessible to the programmer).

Can you assign an ADO recordset to a form?

If so, is the RecordsetClone of an ADO recordset a DAO recordset?
That would be very weird, if it were.


You can bind a form to an ADODB.Recordset and that's a damn
good question.

When directly bound to an ADODB.Recordset the Form.RecordsetC lone
is not a DAO.Recordset. Properties distinct to a DAO.Recordset are
not available. Properties distinct to an ADODB.Recordset are.


Jun 12 '06 #6
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:uw******** ***********@twi ster.nyroc.rr.c om:
David W. Fenton wrote:
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:fS******** ***********@twi ster.nyroc.rr.c om:
David W. Fenton wrote:

As to recordsetclones , I thought all form-based recordsets were
DAO.

The only RecordsetClone I can find in Access, DAO or ADODB is a
property of Access.Form and it is always a DAO.Recordset. The
object browser does not say so. It says it's an Object, but it
has properties that only a DAO Recordset has whether there is a
reference to DAO or not.


Thanks for that -- I rather confused things by referring to the
form's recordset instead of the recordsetclone (I still do most
of my programming in A97, where there is no form recordset object
accessible to the programmer).

Can you assign an ADO recordset to a form?

If so, is the RecordsetClone of an ADO recordset a DAO recordset?
That would be very weird, if it were.


You can bind a form to an ADODB.Recordset and that's a damn
good question.

When directly bound to an ADODB.Recordset the Form.RecordsetC lone
is not a DAO.Recordset. Properties distinct to a DAO.Recordset are
not available. Properties distinct to an ADODB.Recordset are.


In other words, record navigation would have to be done completely
differently, since .FindFirst is DAO only.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 13 '06 #7
rkc
David W. Fenton wrote:
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:uw******** ***********@twi ster.nyroc.rr.c om:

David W. Fenton wrote:
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:fS***** **************@ twister.nyroc.r r.com:
David W. Fenton wrote:
>As to recordsetclones , I thought all form-based recordsets were
>DAO.

The only RecordsetClone I can find in Access, DAO or ADODB is a
property of Access.Form and it is always a DAO.Recordset. The
object browser does not say so. It says it's an Object, but it
has properties that only a DAO Recordset has whether there is a
reference to DAO or not.

Thanks for that -- I rather confused things by referring to the
form's recordset instead of the recordsetclone (I still do most
of my programming in A97, where there is no form recordset object
accessible to the programmer).

Can you assign an ADO recordset to a form?

If so, is the RecordsetClone of an ADO recordset a DAO recordset?
That would be very weird, if it were.


You can bind a form to an ADODB.Recordset and that's a damn
good question.

When directly bound to an ADODB.Recordset the Form.RecordsetC lone
is not a DAO.Recordset. Properties distinct to a DAO.Recordset are
not available. Properties distinct to an ADODB.Recordset are.

In other words, record navigation would have to be done completely
differently, since .FindFirst is DAO only.


You can use ADODB.Recordset .Find to navigate a record in much the
same way you can use FindFirst. The syntax is a bit different.
The bookmark property works with the Form.Bookmark.
Jun 13 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1968
by: gary artim | last post by:
Hi All, I have a problem using DBIx::RecordSet. I get correct results but continue to get these messages on stderr. I looked at Compat.pm and it seems to be pointing out a problem with my call to Setup. Could anyone (much thanks) shed some light on my tired eyes? See below... Gary code sample:
4
3094
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use the recordset to loop thru the recordset, update values from the recordset and then update the database by passing parmeters to another stored procedure. I would like to use the recordset object but can it be used to pass a parameter to a stored...
19
9332
by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not recognise datasets and requires a recordset. Can the datatypes be converted? At the Classic ASP end or .NET end? Can SOAP toolkit provide the conversion, can any toolkit provide a conversion? ...
0
2688
by: CFW | last post by:
I thought this was going to be easy but I'm missing something . . . I need to open an ADODB recordset using the recordset source for a list box on my for. When my form opens, the list box ADODB recordset is established and set during On Open. Next I want to populate a recordset from that list box so I can filter it on a single field using the value of a combo box for the filter string. I have a second combo box that i woul like to use...
6
6556
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query works fine, but passing the resulting recordset back to the sub's caller is not working out.
36
4484
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a dataview with a count = 0. Can someone explain why and how I might work around this problem? Here is the code for my function: Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _ As DataView
0
11312
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 specific moment in time - then gone the next. Few of us realize, however, that they can be saved to disk and later retrieved to will. The technical jargon for this is called 'Persisting a Recordset' and I'll show you how it can be done. ADO has this...
0
9012
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the Recordset? Does the Recordset support Bookmarks? Can we use the Find and/or Seek Methods with this Recordset? Does the Recordset support the use of Indexes? Will the Absoluteposition property be able to be used on this Recordset? etc....
6
5176
by: Oko | last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access 2002. One of the reports within the DB uses data that is Dynamic and cannot be stored on the SQL Server. To resolve this, I have created an ADODB.Recordset in the reports OPEN event, built the necessary records inside of it, and then bound the report to this newly created recordset. Here's the rub:
2
5516
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my results page. - Recordset Paging works if no parameters are used in the recordset sql code (ie. simple sql code): SELECT * FROM db_name WHERE (db_field1 LIKE ‘%text1%’ OR db_field2 LIKE ‘%text2%’)
0
9670
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10430
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10159
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9033
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.