Access 2010 Continuous form tied to a SQL Server view runs query twice before displaying records.

I have a continuous form based on a view from SQL Server 2008R2.  
If i open the view it takes 10 seconds for the records to display.  
If i open the form it takes 20 seconds for the records to display.  You can see the Running Query in the bottom right, it runs for 10 seconds, then starts again for another 10 seconds.
It looks like it runs twice (and unfortunately takes twice as long).

Is this normal?

Any help would be greatly appreciated
BFanguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornSQL Server Data DudeCommented:
<Very wild guess>  Make sure there is not any Form events (i.e. On Open) going on that would alter the View data such that executing the view twice is required.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCCommented:
I agree with Jim, first thought is that there is some code running behind the form which is causing the query to run twice.  Check the Load, Current, and Timer events of the form.
BFanguyAuthor Commented:
Thanks guys,
I had two drop down list boxes,  i have an afterupdate on box 1 that does a count of records for box 2, if the count is 1, i display the records on the form, else, i requery the box2 and set the drop down.  so what i am seeing is the DCount/DLookup running, then the record source requery.

Private Sub Group_AfterUpdate()
If DCount("Resource", "Dashboard_Group_Resources") = 1 Then
   Me.Resource = DLookup("Resource", "Dashboard_Group_Resources")
   Me.FilterOn = False
   Forms!Operations_Dashboard.RecordSource = "Operations_Dashboard"
   DoCmd.Requery
Else
   Me.Resource = ""
   Me.FilterOn = False
   Forms!Operations_Dashboard.RecordSource = "Operations_Dashboard"
   DoCmd.Requery
   Me.Resource.SetFocus
   Me.Resource.Dropdown
End If
End Sub
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

aranaCommented:
Maybe change that second query to the seocnd list GOT FOCUS, so it wont run unnecessarily?
BFanguyAuthor Commented:
arana,
good catch,  no need to requery the form if they have not picked an item from the 2nd drop down box.
If DCount("Resource", "Dashboard_Group_Resources") = 1 Then
   Me.Resource = DLookup("Resource", "Dashboard_Group_Resources")
   Me.FilterOn = False
   Forms!Operations_Dashboard.RecordSource = "Operations_Dashboard"
   DoCmd.Requery
Else
   Me.Resource = ""
   Me.Resource.SetFocus
   Me.Resource.Requery
   Me.Resource.Dropdown
End If
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
RE:
   Forms!Operations_Dashboard.RecordSource = "Operations_Dashboard"
   DoCmd.Requery ' Not needed

Setting the Form Recordsource automatically does a Requery.
No need to do a redundant (and possible performance hit) additional Requery.
BFanguyAuthor Commented:
Joe,  learn something new every day!  this was the definitely the problem!!
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Cool !!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.