![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
#12
| |||
| |||
|
|
David-W-Fenton wrote: "Bob Barrows" <reb01501 (AT) NOSPAMyahoo (DOT) com> wrote in news:j2m372$u3f$1 (AT) dont-email (DOT) me: Only if using a dynamic or keyset cursor. If using a static cursor, then the number of records is known when the recordset is populated. The thing is, when using a non-static cursor, RecordCount should contain -1, Not in DAO -- that's ADO. Hmm, not how I remember it, but I'll take your word for it. |
|
One should never use dbFailOnError without an error handler. True. I had assumed the Op had neglected to include it, but we all know the result of making assumptions don't we. |
#13
| |||
| |||
|
|
It was originally done in access 2003 and works fine. now it does not work in access 2007 and after an update it will not work in access 2003 either. I am confused Private Sub TableDeleteRecords(strTableName As String) Dim rst As Recordset Set rst = CurrentDb.OpenRecordset(strTableName) If rst.RecordCount = 0 Then Exit Sub rst.MoveFirst Do While Not (rst.EOF) rst.Delete rst.MoveNext Loop rst.Close End Sub when you pass any file to this rst.recordcount is always equal to 153. I even passed it a table with nothing in it and it still says 153. |
#14
| |||
| |||
|
|
Changed it to a dynaset and it works. Thanks for the tip. funny how this has worked for about 7 or 8 years then it just quit working. even tracing it on an empty table at recordcount it would show 153. must be something in an update to try and force users to update to newer version. Break it and force sales I am beginning to hate microcrap. On Fri, 19 Aug 2011 09:52:35 -0500, sparks <sparks (AT) home (DOT) com> wrote: It was originally done in access 2003 and works fine. now it does not work in access 2007 and after an update it will not work in access 2003 either. I am confused Private Sub TableDeleteRecords(strTableName As String) Dim rst As Recordset Set rst = CurrentDb.OpenRecordset(strTableName) If rst.RecordCount = 0 Then Exit Sub rst.MoveFirst Do While Not (rst.EOF) rst.Delete rst.MoveNext Loop rst.Close End Sub when you pass any file to this rst.recordcount is always equal to 153. I even passed it a table with nothing in it and it still says 153. |
#15
| |||
| |||
|
|
What tha ok I changed it to a dynaset and it worked. moved over to another computer with the old code and it worked. THIS JUST GETS STRANGER AND STRANGER On Mon, 22 Aug 2011 09:05:19 -0500, sparks <sparks (AT) home (DOT) com> wrote: Changed it to a dynaset and it works. Thanks for the tip. funny how this has worked for about 7 or 8 years then it just quit working. even tracing it on an empty table at recordcount it would show 153. must be something in an update to try and force users to update to newer version. Break it and force sales I am beginning to hate microcrap. On Fri, 19 Aug 2011 09:52:35 -0500, sparks <sparks (AT) home (DOT) com> wrote: It was originally done in access 2003 and works fine. now it does not work in access 2007 and after an update it will not work in access 2003 either. I am confused Private Sub TableDeleteRecords(strTableName As String) Dim rst As Recordset Set rst = CurrentDb.OpenRecordset(strTableName) If rst.RecordCount = 0 Then Exit Sub rst.MoveFirst Do While Not (rst.EOF) rst.Delete rst.MoveNext Loop rst.Close End Sub when you pass any file to this rst.recordcount is always equal to 153. I even passed it a table with nothing in it and it still says 153. |
#16
| |||
| |||
|
|
Changed it to a dynaset and it works. |
#17
| |||
| |||
|
|
ok I changed it to a dynaset and it worked. moved over to another computer with the old code and it worked. THIS JUST GETS STRANGER AND STRANGER |
#18
| |||
| |||
|
|
Lastly, I suggest you use EOF* to test for an empty recordset instead of depending on recordcount anyways. |
#19
| |||
| |||
|
|
sparks <sparks (AT) home (DOT) com> wrote in news:ido457pqg1f16nq995r5aoiglv54q9u555 (AT) 4ax (DOT) com: Changed it to a dynaset and it works. But your original code was a dynaset, because it specifies no recordset type (dynaset is the default). |
![]() |
| Thread Tools | |
| Display Modes | |
| |