Search Tools Links Login

Quick Recordset Properties List


Visual Basic 6, or VB Classic

If you're ever wondering what's contained in a recordset you currently have open, here's a quick and dirty way to dump all the data you could want to the Immediate window, which you can view there, or copy and paste into a notepad document or other textfile for printing, etc.
I like to keep this somewhere I can quickly copy and paste it into any module or routine that uses a recordset in case I lose track of which field is which.
(I've only tried this with VB 6.0 and AO 2.6, but I imagine it would work with other versions.)
--Brian Battles WS1O
Middletown, CT USA

Original Author: Brian Battles WS1O

Assumptions

Needs a currently open recordset

Returns

A list of fields and property info in the Immediate window

Side Effects

none known

Code

Private Sub ListRecordsetProperties()
  ' provides a list of all current recordset fields and their properties;
  ' use with any currently open ADO recordset (rs in this example)
  Dim I As Integer
  Dim J As Integer
  
  For I = 0 To rs.Fields.Count - 1
    Debug.Print vbCrLf & "Field " & I & " Name: '" & rs.Fields.Item(I).Name & "'" & vbTab & "Value: '" & rs.Fields(I).Value & "'" & vbCrLf & " Properties..."
    For J = 0 To rs.Fields(I).Properties.Count - 1
      Debug.Print "  Index(" & J & ") " & "Name: " & rs.Fields(I).Properties(J).Name & " = " & rs.Fields(I).Properties(J).Value & vbTab & vbTab & "Type: " & rs.Fields(I).Properties(J).Type & "," & vbTab & "Attributes: " & rs.Fields(I).Properties(J).Attributes
    Next J
  Next I
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 86 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.