refresh recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

I have the following code with a loop...

....
strSQL = select tbl_list.name INTO tbl_temp FROM tbl_list WHERE
[tbl_list].[name] = '" & rst![facility code] & "DETAILS'"

docmd.runswl strSQLA
msgbox rst3.rcordcount

if rst3.recordcount <> 1 then
....

i noticed that even if the running the strSQLA puts 0 rows in the new table,
the message box stil shows me "1" as the recordcount

how can i get this to refresh?

thanks in advance,
geebee
 
In
geebee said:
hi,

I have the following code with a loop...

...
strSQL = select tbl_list.name INTO tbl_temp FROM tbl_list WHERE
[tbl_list].[name] = '" & rst![facility code] & "DETAILS'"

docmd.runswl strSQLA
msgbox rst3.rcordcount

if rst3.recordcount <> 1 then
...

i noticed that even if the running the strSQLA puts 0 rows in the new
table, the message box stil shows me "1" as the recordcount

how can i get this to refresh?

Note: it would have been better to have copied and pasted the code, not
transcribed it manually, which has introduced errors. More to the
point, you don't give enough code to let us see what's going on, nor
what relationship rst3 has to the table you're creating.

I'm going to assume that you have opened the recordset rst3 on tbl_temp.
After that, you've updated the contents of tbl_temp by some other means
than rst3. To get rst3 to reflect the modified contents of tbl_temp,
you should requery it:

rst3.Requery

Furthermore, if rst3 is anything but a table-type recordset, you must
also move to the end of the recordset after requerying it, to make the
record count accurate:

With rst3
If Not .EOF Then .MoveLast
End With

Now the recordset's RecordCount property will be accurate.
 
Back
Top