Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

debug.print recordset

Status
Not open for further replies.

KUZZ

Technical User
Aug 13, 2002
254
GB
HERE IS MY CODE

Dim rst As Recordset
Dim cnn As ADODB.Connection
Dim strFilter As String
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset

STRPROMPT = "PLEASE ENTER PART NUMBER"
vPTNR = InputBox(PROMPT:=STRPROMPT, _
Title:="PART NUMBER", XPos:=5000, YPos:=5000)

STRPROMPT = "PLEASE ENTER REVISION"
vREV = InputBox(PROMPT:=STRPROMPT, _
Title:="REVISION", XPos:=5000, YPos:=5000)


rst.Open "tblfinishing", cnn, adOpenKeyset
strFilter = "[ptnr]='" & vPTNR & "' and [rev]='" & vREV & "'"
rst.FILTER = strFilter

If rst.BOF = True Then
OFCHECK = True
ElseIf rst.EOF = True Then
OFCHECK = True
Else
OFCHECK = False
End If

Select Case OFCHECK
Case Is = False
'********
'********
'********
Case Else
MsgBox "No record for part number " & vPTNR & " and revision " & vREV & "."
End Select

rst.Close


NOTICE THE ******** IN THE CODE

I need to write something that would display the records in the filtered recordset in a table format (this is needed for reference only, no need to store the filtered records in another table)

How do I do this?

Good luck,
Kuzz

"Time spent debating the impossible subtracts from the time during which you
can try to accomplish it."
 
Just to the immidiate pane?

[tt]dim l as long
if not rst.bof and not rst.eof then
do while not rst.eof
for l = 0 to rst.fields.count-1
debug.print rst.fields(l),
next l
debug.print
rst.movenext
loop
end if[/tt]

Roy-Vidar
 
Thank you very much for the advise. That works great. Now how can I output the same test to a pop up message box, or send into a temporary table a query. Do you know if that is possible?



Good luck,
Kuzz

"Time spent debating the impossible subtracts from the time during which you
can try to accomplish it."
 
Please, you stated "this is needed for reference only, no need to store the filtered records in another table" and the subject line is "debug.print recordset"

Everything is possible, I just <put in some appropriate term describing distaste> to answer a precise question only to hear that what was explicitly stated not needed suddenly is!

[tt]dim l as long
dim s as string
if not rst.bof and not rst.eof then
do while not rst.eof
for l = 0 to rst.fields.count-1
s=s & rst.fields(l)
next l
s=s & vbcrlf
rst.movenext
loop
end if[/tt]

You'll need to do some formatting to get it "tabular", pad the field values... Place "s" whereever you need. For more assistance, recordset/table... do a search or hope someone else pops in...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top