Changing Form RecordSource and then Requery (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 23:15
Joined
Sep 21, 2011
Messages
14,310
I have seen a few posts recently whereby members are changing recordsource and then issuing a Me.Requery after it.

As I have mentioned in those threads, I was under the impression that just changing the recordsource is in effect a requery in itself.

I have just tried to test this is a test form and got the following.

Am I wrong in this regard? The debug seems to indicate not? Whilst a few records in table/query is not going to make much difference I know, I would expect with large datasets it is inefficient?

Source is tblDates for the form in it's properties. I just changed the order as the test.

1703946036781.png
 

cheekybuddha

AWF VIP
Local time
Today, 23:15
Joined
Jul 21, 2014
Messages
2,280
Am I wrong in this regard?
No, you are right.

The .Requery is totally unnecessary in this instance.

People do it because they don't really understand what's happening in the code.

With modern PC's and in most instances of underlying recordset size, it is probably un-noticeable though!
 

cheekybuddha

AWF VIP
Local time
Today, 23:15
Joined
Jul 21, 2014
Messages
2,280
It even states this explicitly in a note in the docs

Note

Changing the record source of an open form or report causes an automatic requery of the underlying data. If a form's Recordset property is set at runtime, the form's RecordSource property is updated.
 

Users who are viewing this thread

Top Bottom