I have these two lines in a VBA function:
And the SqlToDo variable looks like this when executing:Code:... SqlToDo = "SELECT * FROM tblc_38_SeqId WHERE UseTbl=""" & aUseTbl & """ And UseFld=""" & aUseFld & """" Set rs = dbs.OpenRecordset(SqlToDo, , 3) ...
SELECT * FROM tblc_38_SeqId WHERE UseTbl="tbl_39_Entity" And UseFld="ID"
(UseTbl and UseFld are in a nonduplicate, composite index, so only one record is read.)
It seems to work, as far as reading the record, but I have a few questions, not sure what the M$ documentation is saying:
1) Should the "3" argument in Set read and write lock the record (I need to increment the value of one field)?
If not, what is the correct way?
2) I tried changing the record in the datasheet view, and it let me, so I'm guessing it's not really locked.
3) How does the record get unlocked (with a write?)? If I don't write the record back, will it still get unlocked with the rs.close before the exit funtion?
4) Is there a way to test that there wasn't an actual record read other than an error when trying to do something with a rs!field? (Use rs.EOF?)
5) I want to write some values back to the record, what does a statement look like to do that (if not just change the RS! field and do rs.Update)?
Thanks!