Darryl Collins
darryl at whittleconsulting.com.au
Sun Jul 31 22:28:26 CDT 2011
Hi guys & Gals,
Slower day at work today so I was poking around some code they use here in
my new role and found this syntax when dealing with recordsets in Access VBA
rsR.AddNew
rsR("order") = rsM("order")
rsR("sheetname") = rsM("sheetname")
rsR("sheetnumber") = rsM("sheetnumber")
rsR.Update
It is very, ummm, MS Excel in style, but it does work ok and update the
recordset(s) correctly.
However I would have written it like:
With rsR
.AddNew
!order = rsM!order
!sheetname = rsM!sheetname
!sheetnumber = rsM!sheetnumber
!Update
End with
Not withstanding then with / end with bit. What is the advantage (if any)
of one syntax over the other? Is one method faster?
Actually, Why does the first syntax even work? I would have though you
would have had to use the ! method, but very clearly I am totally wrong on
that count.
I had not seen code used like that before for MS Access recordsets. Maybe I
need to get out more?
Your thoughts?
Cheers
Darryl