I'm currently developing a database and have a lot of test data in tables. Occasionally I'll need to change some of this test data, and to save time I'll create a loop to change data in my tables instead of manually going in and changing every value.
The last few times I've tried this, Access has crashed.
At first I thought it was because the Recordset I was changing had too many records (somewhere around the 100 - 200 range), but the latest occurrence of this issue only had 9 records to go through.
I've tried using 'Do Until Recordset.EOF' and 'For i = 1 to #OfRecords' and gotten the same result.
This is odd, because I have a few forms that use 'Do Until Recordset.EOF' in various events, and they're still working just fine. This has only happened when I create a new button and put the loop behind it with the intention of just deleting the button and the code once I've made the changes.
Here's my latest attempt at this, which just crashed Access a few minutes prior to me posting this.
It's probably worth noting that at first I was trying to change rs(3), (4), (5), (6), and (7), but after that crashed Access I lowered it to just rs(3) to see if that was the issue. All of these fields being changed are number fields, none of them are 0, and nothing will result in something being 0.
Code:
Dim var1 As Double, Rsize As Integer, db As Database, rs As Recordset
Set db = Currentdb
Set rs = db.OpenRecordset("tblName")
Rsize = DLookup("size", "tRAMSize")
rs.MoveFirst
Do Until rs.EOF
var1 = rs(3)
var1 = var1 / 10
var1 = var1 * Rsize
var1 = Round(var1)
rs.Edit
rs(3) = var1
rs.Update
Loop
Any help is greatly appreciated