473,703 Members | 3,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Speed tip: Set RowSource of Subform's Combo box in GotFocus event rather than Enter

Hello all,

I just discovered something (stop me if you've heard this before....) that
was causing me a significant performance hit when opening a form with
subforms.

To speed up loading the form, I set the rowsources of its, and its
subforms', combo boxes in the "Enter" events of the combo boxes. That's the
standard trick for not loading the rowsource unless/until the user actually
needs the combo box. For example:

If Me!cboInitial.R owSource = "" Then _
Me!cboInitial.R owSource = Me!txtPrefix & "refCarInitials " ... or
some query

I also set the subforms' SourceObjects, LinkChildFields , and RecordSource in
the Load event of the main form.

What I discovered is that setting the SourceObject, etc fires off the Enter
event of the combo boxes in the subforms. In fact, even if you don't set
these properties in the code, but instead have them predefined, Access will
"Enter" the combo boxes of the subforms when opening up the main form. So
the RowSources of those combo boxes get run way before the user has a chance
to click on them. This defeats the aim of speeding up form loading by
avoiding filling those RowSources until needed.

The solution was simple enough - move the RowSource code to the GotFocus
event of the combo boxes, which does not get fired by the main form opening.

Note that for combo boxes on the main form, it doesn't matter, as they
aren't "entered" when the main form is opened. It's the main form's act of
"setting up" its subforms that causes Access to enter the subforms' combo
boxes. You can test this be putting breakpoints or messageboxes in the
"Enter" events of the combo boxes.

Thought this might help someone. BTW, I got the inspiration for the
solution from an old post I read from someone (was it David Fenton?) who
said he couldn't remember why he always put the RowSource code in the
GotFocus event rather than the Enter event. Maybe this was why?

Regards,
Krisa

Nov 12 '05 #1
0 3532

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9365
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where clause after users typed in one or several letters/digits. My problem is as follows Most of the time I need to display form in continuous format, that means the combo box will appear in each record. For example I have a form to let users view...
25
10248
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
7
8523
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products purchased by a customer, both Active and Inactive in a ComboBox, cbProducts. My client wants to view all...
4
7016
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
14
2180
by: Steve Jorgensen | last post by:
I just got paid to solve this problem for one client, so I might be impeding future business opportunities by sharing this secret, but a rising tide floats all boats, so... I've seen this mysterious problem now in many Access C/S applications. Usually some random GUI or workflow changes make the problem, but for at least one of my clients, the problem was chronic. You have an Access form bound to a linked SQL Server table. You try to...
8
6156
by: bbdata | last post by:
ok i have a problem here and not much time to play round. have a form bound to a table. one of the combos is bound to a field Agents. i have active and retired agents. thing is, i want to be able to retrieve all agents from the table, but to see only active in dropdown list of the combo, to asure accurate data entry. if i filter the agents table for a rowsource to get back only active in the dropdown, i cant retreive names of the rest when...
6
4217
by: lauren quantrell | last post by:
I have a combo box on a form. It uses the GotFocus event to poopulate the rowsource with a value list that is created on the fly in VBA. Fine and dandy, except, is a user opens another form and returns to the form with the rowsource, the rowsource is not refreshed because the combo box doesn't execute the GotFocus event because it has never lost the focus. If I put the code to generate the value list in the MouseDown event of the combo...
13
4177
by: nyt | last post by:
I have a problem of number and text field. I got the database file(mdb) that contains many combo boxes used and its list values are created by "value list" For eg field Field name= 'furniture' , data type='Number' ,Display Control='Combo Box', RowSource Type = 'Value List' and Row Source = ' 0;"chair";1;"Table";2;"Bed" ' Therefore, in data sheet view of table, if we select (1 : Table ) ,
5
8509
by: jaynea | last post by:
Hi I have a main form which contains questions and a subform within it which contains elements which relate to the main form. they are linked by a field called question_ref so if I page through the records on the main form the elements that are relevant to that question display in the subform. Within the subform I have a combo box which calls a table which contains the following question_ref and a text field. I would like to be able to...
0
9252
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8966
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6588
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4433
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3125
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.