Time it take to load form

  • Thread starter Thread starter Thomas Kroljic
  • Start date Start date
T

Thomas Kroljic

Hello All,
I have an Access 2002 database. I have one form that I noticed takes
quite awhile to
appear on the screen. This particular form has many "unbound" fields that
get initialized during
the "Form Load" event.

I'm trying to determine if I can somehow get the form to display quicker
on the screen. I noticed with some
testing that if a form has fields that are directly linked to the
underlying table, the form appears almost
instantaneous. But if I add several "unbound" fields to the form and use
vba code in the Form Load
event, the displaying of the form takes 3 to 8 seconds longer depending on
the number of "unbound" fields
and the logic being used.

is this normal? It seems that if a form has fields tied directly to the
table it's display is lighten fast. If the
form has many unbound fields which get initialized during the Form Load
event, it slows down considerable.

If this is normal, does anyone have any suggestion on what I can do to
speed up the display of this form.

Thank you,
Thomas J. Kroljic
 
Set the default value property of the unbound controls and the form will
load as fast as if all the controls were bund to fields in the underlying
table.
 
Thanks for the quick response.
Not sure I exactly understand what you are suggesting. Currently, on the
"Form Load" event, I perform the following code:

'if the PO number is null, create a temporary PO number for this
record
If IsNull(Me.POnumber) Then
Dim mPONumber As String
mPONumber = Trim(Time()) + pEmpName
Me.POnumber = mPONumber
Me.PO_CreationDate = Format(Now(), "mm/dd/yyyy")
Me.PO_Status = "Pending"
Me.txt_orderdate = Format(Now(), "mm/dd/yy")
Me.txt_shipdate = Format(Now(), "mm/dd/yy")
Else
mPONumber = Me.POnumber
End If
'check the status field in the header record to determine
'if command button should be displayed.
If Me.PO_Status = "Generated" Then
Me.cmd_GeneratePO.Visible = False
Else
Me.cmd_GeneratePO.Visible = True
End If

'fill in the vendor/ship-to address if available
'data is moved from a combo-box to the unbound controls
If Not IsNull(Me.txt_vendor) Then
Me.txt_vendoraddress = Me.txt_vendor.Column(3)
Me.txt_vendorcity = Me.txt_vendor.Column(4)
Me.txt_vendorstate = Me.txt_vendor.Column(5)
Me.txt_vendorzip = Me.txt_vendor.Column(6)
Me.txt_shiptoaddress = Me.txt_shipto.Column(3)
Me.txt_shiptocity = Me.txt_shipto.Column(4)
Me.txt_shiptostate = Me.txt_shipto.Column(5)
Me.txt_shiptozip = Me.txt_shipto.Column(6)
End If

Are you suggesting that I move these value to the "Default Value" field
under the Data tab on the properties for each unbound control?
 
The whole thing doesn't make sense! When a form loads, it loads the first
record or a new record if there are no records. If the first record loads,
why are you assigning all the PO stuff? And why is all the vendor stuff in
unbound controls? If it is a new record, this is only going to happen once
until you create a record so why do any of this at all? It appears you have
made this form way more complex than it needs to be or else the logic does
not make sense. Perhaps if you provide the pertinent tables and fields this
can all be sorted out.

Steve
PC Datasheet
 
Steve,
Since your last posting, I've done away with the unbound fields and the
vba code that would move data to them on the "Form Load" event.
I originally used the unbound fields to ensure that if a change to the
Vendor
information (in another table) was changed, it would be reflected on the
form I was trying to open up.

I did some google searches and found two items of interest: one has to do
with
the Name Auto Correct parameters (tools/options) and the Subdatasheet Name
property on the database table. I've unchecked the Name Auto parameter and
set
the Subdatasheet Name to None on the appropriate tables. I also compacted
the
database containing all the forms, queries, modules...

The form seems to be opening up very fast now. I still don't feel
comfortable that I've resolved
the problem. I still have more logic to add to this form, especially for the
one subform that is
on (linked) to this form.

Currently, the Database is roughly 100mb. I have a split database
environment (fe and be).

If you know of any other areas I might check to help improve the speed at
which the form
opens, I'd love to hear about it. Is there any way to speed up the execution
of the vba code?
Can I compile it? And if so, does this improve speed (execution)?

Again, thanks for sharing your thoughts with me.

Thomas J. Kroljic
 
<<Can I compile it? And if so, does this improve speed (execution)?>>
A definite Yes.

100mb??? Do you have graphics in the database? If not, you would have to
have a total of 1000 queries + forms + reports to get this large!! Perhaps a
problem?

Does your form have graphics? That would make it load slow.

Many comboboxes and/or listboxes would make it load slow.

A recordsource of an SQL rather than a query would make it load slower.

Steve
PC Datasheet
 
Steve,
I current have the following in the database:
256 forms - each form has a vba module
432 queries
112 reports
total 800

I also have 4 regular modules and 4 class modules.

No graphics stored in the database.

I've update "the" form with more changes and enhancements. So far so good.
I think setting the
Name AutoTrack, subdatasheet Name, and compacting the db helped. The form
opens up normally
now.

I'll look at the help files to find out how to compile the vba code.

Thanks again for your responses and questions.

Thomas J. Kroljic
 
Back
Top