Debugging a recordset 
Author Message
 Debugging a recordset

Presse,

During testing, you could always call a custom procedure which uses
Debug.Print. For example:

Public Sub TestRS()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
        Set db = CurrentDb
        Set rs = db.OpenRecordset("table7", dbOpenSnapshot)
        Print2Immed rs
    rs.Close
    db.Close
    Set rs = Nothing
    Set db = Nothing
End Sub

Public Sub Print2Immed(rs As Recordset)
    Dim ctr As Integer
    For ctr = 0 To rs.Fields.Count - 1
        Debug.Print rs.Fields(ctr).Name & " : " & rs.Fields(ctr).Value
    Next ctr
End Sub

Graham R Seach
Microsoft Access MVP
Sydney, Australia


Quote:
> Hello group,

> While debugging, I've often wished I could simply print out to the
immediate
> pane the contents (part, or all) of a .recordset object which I currently
> have open.

> Not wanting to reinvent the wheel here, I was wondering if anyone knows of
> the existence of code to do this anywhere.  Would be nice if it handeled
ADO
> and DAO recordset objects equally well!

> Regards!

> Presse/Montreal



Fri, 04 Mar 2005 20:51:00 GMT  
 Debugging a recordset
Hello group,

While debugging, I've often wished I could simply print out to the immediate
pane the contents (part, or all) of a .recordset object which I currently
have open.

Not wanting to reinvent the wheel here, I was wondering if anyone knows of
the existence of code to do this anywhere.  Would be nice if it handeled ADO
and DAO recordset objects equally well!

Regards!

Presse/Montreal



Fri, 04 Mar 2005 20:29:00 GMT  
 Debugging a recordset
You can print the value of a field in the current record with Debug.Print
RecordsetNameHere.Fields("FieldNameHere")

You can print the value of each field in the current record with something
like:

    For Each fld In RecordsetName.Fields
        Debug.Print fld.Value,
    Next fld

Or did you mean something else?

--
Brendan Reynolds (MVP)

Access 2000/2002 sample app at
http://brenreyn.brinkster.net
----------------------------

Quote:
> Hello group,

> While debugging, I've often wished I could simply print out to the
immediate
> pane the contents (part, or all) of a .recordset object which I currently
> have open.

> Not wanting to reinvent the wheel here, I was wondering if anyone knows of
> the existence of code to do this anywhere.  Would be nice if it handeled
ADO
> and DAO recordset objects equally well!

> Regards!

> Presse/Montreal



Fri, 04 Mar 2005 20:48:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Recordset.Update doesn't update on runtime only when debugging the code

2. Update recordset from another recordset

3. FILTERING RECORDSET BASED ON ANOTHER RECORDSET

4. Opened Recordsets don't show up in Recordsets Collection

5. Creating a recordset from existing recordsets

6. Creating a recordset based on another recordset

7. Basing a recordset on a previous recordset not working

8. Recordset from recordset ?

9. Extracting a recordset from a recordset

10. Appending a recordset with a copied? recordset record

11. Recordset from recordset

12. Recordset Experts...SQL statement on an open recordset?

 

 
Powered by phpBB® Forum Software