![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
160 Dim DB As Database, Rst As Recordset, QD As QueryDef 170 Set DB = CurrentDb() 180 Set QD = DB.CreateQueryDef("", MySQL) 190 Set Rst = QD.OpenRecordset(dbOpenDynaset) HOW TO COUNT RECORDS IN Rst BEFORE NEXT LINE? 200 Rst.MoveFirst |
#3
| |||
| |||
|
|
MLH wrote: 160 Dim DB As Database, Rst As Recordset, QD As QueryDef 170 Set DB = CurrentDb() 180 Set QD = DB.CreateQueryDef("", MySQL) 190 Set Rst = QD.OpenRecordset(dbOpenDynaset) HOW TO COUNT RECORDS IN Rst BEFORE NEXT LINE? 200 Rst.MoveFirst Either... If Not Rst.EOF Then... Or If Rst.RecordCount > 0 Then... Note that upon opening a Recordset the RecordCount cannot be trusted for an accurate total count until you do a MoveLast, but it CAN be trusted to indicate whether there are zero records or (something more than zero). |
#4
| |||
| |||
|
|
Note that upon opening a Recordset the RecordCount cannot be trusted for an accurate total count until you do a MoveLast, but it CAN be trusted to indicate whether there are zero records or (something more than zero). |
#5
| |||
| |||
|
|
Rick Brandt wrote: Note that upon opening a Recordset the RecordCount cannot be trusted for an accurate total count until you do a MoveLast, but it CAN be trusted to indicate whether there are zero records or (something more than zero). Is that true for DISTINCT queries as well? I seem to remember doing some tests and it always returned the correct recordcount w/o MoveLast. |
#6
| |||
| |||
|
|
Rick Brandt wrote: Note that upon opening a Recordset the RecordCount cannot be trusted for an accurate total count until you do a MoveLast, but it CAN be trusted to indicate whether there are zero records or (something more than zero).alted perhaps Is that true for DISTINCT queries as well? I seem to remember doing some tests and it always returned the correct recordcount w/o MoveLast. |
![]() |
| Thread Tools | |
| Display Modes | |
| |