Print Current Record from Recordset

GohDiamond

"Access- Imagineer that!"
Local time
Yesterday, 19:26
Joined
Nov 1, 2006
Messages
550
Is there a way to print the current record from a dao.recordset?

This is an exercise to compare data content.

I have a table with 30 fields and thousands of rows (rs1).
I'm comparing it with a copy of the same table (rs2) that has the same number of fields and the same rows and almost the same content.

I can loop through the recordsets and get the cursor to stop on a field whose values don't match, lets say on row #x

and the programmed message will say something like:

"ROW: 699 Field: [RequestStatus] rs1.VALUE: Closed, DOES NOT MATCH rs2.Value: VOID, in the comparison recordset"​

Then I'd like to print the entire Row, Row #699.

I thought I could use rs1.getrows but I'm not sure how to make that work.
Any Ideas or solutions?

Thanks in advance for the lift,
Goh
 
How do you identify row 699?
What sort of data does the table contain?
 
While Not rs1.EOF
Rownum= RowNum+ 1 ' Heres the row counter

For X = 0 To rs1.Fields.Count - 1

'Trap Field Value Differences here
If (rs1.Fields(X).Name = rs2.Fields(X).Name) And (rs1.Fields(X).Value = rs2.Fields(X).Value) Then
'Move on
Else
S = rs1.Fields(X).Name & " ROW: " & RowNum - 1 & " Field: [" & rs1.Fields(X).Name & "] VALUE: " & rs1.Fields(X).Value & " DOES NOT MATCH Value: " & rs2.Fields(X).Value & vbNewLine
GoSub GoPrint ' subroutine at bottom of process to print S to Immediate and to Log
End if​
Next​
rs1.MoveNext
rs2.MoveNext​
Wend

So RowNum - 1 gives me the row number

The data is of a variety of types: ShortText, number, date, LongText; stuff you might find in HR Profiles
I'm working in MS Access 2013 Desktop

Thanks for the views,
Goh
 
Tables have no inherent Order. Is there no identifier in your record that can uniquely identify the record?
 
The two tables should be identical, with the same number of rows, same fields, and same field content. A least that is the goal. The SQL statement governing the 2 recordsets forces a sort order by UserID and RequestID which should put every record and every field in the exact same sequence and order, as a static, unchanging snapshot.

Set rs1 = db.OpenRecordset("SELECT * FROM [" & Table1 & "] ORDER BY[User Id], [RequestID];", dbOpenSnapshot)
Set rs2 = db.OpenRecordset("SELECT * FROM [" & Table2 & "] ORDER BY[User Id], [RequestID];", dbOpenSnapshot)

The RequestID should be unique by row

The purpose is to evaluate the DEVELOPMENT output to Excel vs. the current PRODUCTION output to Excel. A separate Database tool is being used to evaluate these outputs with a thorough comparison of the resulting contents by field (a very granular level). That's what this exercise is for.

DEVELOPMENT takes place in an isolated instance of the database so as not to affect the current PRODUCTION db environment. When DEVELOPMENT has been fully tested by the developer (aka ME) and the resulting outputs match the current PRODUCTION outputs, then it will go to UAT. When UAT passes it will become the revised PRODUCTION version with the additional features and optimized processing requested by the users.

Cheers,
Goh
 
Last edited:

Users who are viewing this thread

Back
Top Bottom