Full Version: DoCmd.Close very slow in A2007
UtterAccess Forums > Microsoft® Access > Access Forms
Alan_Lee
I have a Switchboard form in my database, which amongst other things points to a Contact's page - where there are about 5000 records.
On my Contacts form, on the Load Event I have the command Forms!Switchboard.Visible = False.
The Data Source for the contact form is a is a query. Does this matter ?
Oclose the Form with a DoCmd.close button.
There is also a on Unload Event : Forms!Switchboard.Visible = True.
This was all really simple and worked a treat in A2003. When I run it on A2007, it takes a good few seconds for the form to physically leave the screen. I originally retained the database as A2003 format. I have now upgraded it to an A2007 format, but the problem persists.
The problem is equally bad when I leave out the Switchboard visible changes. It is all very frustrating.
Any ideas, please ? TIA Alan
trapperalexander
Alan,
If your query is doing many calculations or has things like Dlookup or Dsum or several IIF statements, it will run slower. Try consolidating your query and removing any 'D' functions and IIF statements using multiple queries.
-Trapper
Alan_Lee
Thanks for the rapid response.
The query is very simple, I either select the archived or the non archived contacts - a simple boolean field. The only slight complication is that I use the same form for both - but that I select the Record Source in the Open Event :
Private Sub Form_Open(Cancel As Integer)
If ArchClient = False Then
Me.RecordSource = "qryAllContactsLive"
Me!SelectName.RowSource = "qryNameFirstLookupLive"
Me!SelectSurname.RowSource = "qryNameSecondLookupLive"
Me!btnArchive.Caption = "Archive this Contact"
Else
Me.RecordSource = "qryAllContactsArchived"
Me!SelectName.RowSource = "qryNameFirstLookupArchived"
Me!SelectSurname.RowSource = "qryNameSecondLookupArchived"
Me!btnArchive.Caption = "Unarchive this Contact"
End If
End Sub
The main issue I have is that in A2003, closing the form was instant. In A2007 it is unacceptably slow.
Thanks, Alan
trapperalexander
Alan,
I am afraid I am unable further assist you, I do not have the expertise! Only other thing I can think of is compact&repair, but you have probably already done that. sorry...
I am sure someone else will have some advice!
-Trapper
MDM_Inc
On the button to close the form replace the code to be this:
DoCmd.Close acForm, me.Name, acSaveNo
See if it closes the form any faster. My guess is that since you are changing the form's record source and a couple of combo boxes/list boxes row source Access is trying to save the form when it closed.
Alan
Alan_Lee
Alan,
Thanks for the idea - which I thought would work, but sadly the closing is still way too slow.
Thanks, Alan
Grafixx01
Alan,
That do you mean by "slow"? I'm just trying to figure out if you mean like nano-seconds, seconds, minutes, hours?
Alan_Lee
Just timed it and it was just under 20secs.
My concern is that in A2003 it was instant. My users will get very irritated with this delay.
hey have also said that processing inside the form is slower - but I cannot quantify this.
I would have thought that this might have been an issue elsewhere for converted A2007 databases.
Thanks, Alan
Alan_Lee
I just went back and did another test.
When the query has 5,800 records the close form takes 20 secs.
When I look at the Archive list which has very few records, the close is almost instant.
till puzzled that this did not happen in A2003.
Thanks, Alan
Alan_Lee
I had a very good tip from the Microsoft Discussion Group which has sorted this problem.
The solution is to load the MS Hotfix : http://support.microsoft.com/kb/943249/en-us
Alan
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.