[RESOLVED] ADO to update MDB records
I've been using Excel VBA and ADO to practice SELECTing and FILTERing records from an MDB file. I used the following code to change values in certain records and was surprised that the MDB file had been updated. Is this normal behavior? I thought the recordset existed in memory only and the UPDATE command was needed to actually save the results to the DB.
Code:
rs.Filter = "FIELDA = NULL"
Do While Not rs.EOF
rs.Fields("FIELDA").Value = rs.Fields("FIELDB").Value
rs.MoveNext
Loop
Re: ADO to update MDB records
The answer is "maybe" ... sounds like you had a connected recordset... in which case, yup, when you change something like that and move to the next record, the changes are saved. If the recordset is diconnected, then you could make changes, then connect back to the database and use UpdateBatch to push the changes... either way, you don't need an explicit UPDATE command.. it infers the table schema when you open the recordset... so it can keep track of what rows have been updated.
-tg
Re: ADO to update MDB records
Thanks, I understand now.