Darryl Collins
darryl at whittleconsulting.com.au
Mon Aug 1 18:15:08 CDT 2011
Thanks Steve - Nice :) Actually that is probably how I would end up doing
it on the 2nd rebuild. I use that style of code a lot more now where a few
lines do a fair bit of the work.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 'Steve Goodhall'
Sent: Monday, 1 August 2011 11:04 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] rsR("order") vs rsR!Order
Another option would be something like:
rsR.addnew
for each oFld in rsR.fields
rsR.value = rsM.fields(rSR.Name).value
next
rsR.update
This is air code and has not been tested.
Regards,
Steve Goodhall, MSCS, PMP
248-505-5204
----- Original Message -----
From: Access Developers discussion and problem solving
To:"Access Developers discussion and problem solving"
Cc:
Sent:Mon, 01 Aug 2011 08:20:23 -0400
Subject:Re: [AccessD] rsR("order") vs rsR!Order
It's also a tad faster. All the bang/dot notation internally is
converted
to that format before being executed.
Jim.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com [1]
[mailto:accessd-bounces at databaseadvisors.com [2]] On Behalf Of
Darryl Collins
Sent: Sunday, July 31, 2011 11:28 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] rsR("order") vs rsR!Order
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
rsRAddNew [3]
rsR("order") = rsM("order")
rsR("sheetname") = rsM("sheetname")
rsR("sheetnumber") = rsM("sheetnumber")
rsR.Update [4]
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
--
AccessD mailing list
AccessD at databaseadvisors.com [5]
http://databaseadvisors.com/mailman/listinfo/accessd [6]
Website: http://www.databaseadvisors.com [7]
--
AccessD mailing list
AccessD at databaseadvisors.com [8]
http://databaseadvisors.com/mailman/listinfo/accessd [9]
Website: http://www.databaseadvisors.com [10]
Links:
------
[1] mailto:accessd-bounces at databaseadvisors.com
[2] mailto:accessd-bounces at databaseadvisors.com
[3] http://rsR.AddNew
[4] http://rsR.Update
[5] mailto:AccessD at databaseadvisors.com
[6] http://databaseadvisors.com/mailman/listinfo/accessd
[7] http://www.databaseadvisors.com
[8] mailto:AccessD at databaseadvisors.com
[9] http://databaseadvisors.com/mailman/listinfo/accessd
[10] http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com