What is meant by "load at run-time"? For Tony

  • Thread starter Thread starter Denise
  • Start date Start date
D

Denise

This is from Granite Consulting site.
"This is the tip: Load the form, subform, combobox and listbox record
sources at run-time. "
Would appreciate an explanationof what is meant by run-time. I don't want
to assume.
 
I think what Tony's suggesting is that rather than setting the form's
RecordSource or the combo or list box's RowSource when you save the form in
Design view, leave them blank, then put code in the form's Open event to set
them.

In order to design the form properly, you'll obviously need to tell it what
the recordsource is. Once you've got the form working to your liking,
though, go to its properties, and see what's in the RecordSource property.
Cut that to the clipboard, then go into your form's Open event procedure and
add code like:

Private Sub Form_Open(Cancel As Integer)

Me.RecordSource = "...."

End Sub

(replace .... above with whatever you cut from the form's Property sheet)
 
Hi Doug, long time...

Actually, Tony explains to put the code on the 'Form_Load' event that sets
the recordsources, and then set them all back to "" in the 'Form_Unload'
event.

http://www.granite.ab.ca/access/performanceforms.htm

I started utilizing that tip when I ran across it back a few years and
though I didn't experience the kind of dramatic results Tony did, I do think
it helped and, in some cases, a significant amount.
 
I also load recordsources and combo boxes on the form_load event. Is
there any reason why you set them back to "" in the Form_Unload event?
 
Douglas J. Steele said:
I think what Tony's suggesting is that rather than setting the form's
RecordSource or the combo or list box's RowSource when you save the form
in Design view, leave them blank, then put code in the form's Open event
to set them.

In order to design the form properly, you'll obviously need to tell it
what the recordsource is. Once you've got the form working to your liking,
though, go to its properties, and see what's in the RecordSource property.
Cut that to the clipboard, then go into your form's Open event procedure
and add code like:

Private Sub Form_Open(Cancel As Integer)

Me.RecordSource = "...."

End Sub

(replace .... above with whatever you cut from the form's Property sheet)
 
Hi jovii,

I'd say the point of doing that is so that the next time you open the form,
you get the benefits of waiting to load the recordsources on the Load
event....just like you did the first time you opened the form.

CW
 
Back
Top