Access pass-through query is running after results are displayed

I have a form to collect parameters for a pass-through query in Access.  The pass-through query executes a stored procedure.  The results of the stored procedure are to be displayed in a results form.  I've done this before with no-problems, but I must be overlooking something now because when my results page come up it does not display the results from my current paramters, it displays results from the last paramters I entered on my last attempt.  For example, if I enter a date of '2009' to send to the stored procedure and then I view the results form, I dont see results for 2009, I see results from the last paramater I entered.  If I do it again and now enter '2010', I now see results for 2009 and so on.  My pass-though query is recieving the current paramaters I entered, because when I look at it in design view, I see the current paramters I just entered.  I think I need another set of seems like my results are not being sent until after the fact.

My paramters form (frmSearchgroupby) simply has unbound text boxes and a button to open the results form.
My pass-through query (qrySQLSearchDocs) is this:  exec spSearchDocs
My stored procedure (spSearchDocs...tested and works great in sql) is this:

USE [DocDb]
ALTER PROCEDURE [dbo].[spSearchDocs]
        @txtDocSearch varchar(6) = null,
        @txtYearSearch int = null,
        @txtGorLastSearch varchar (50)=null
      SELECT * from DocDb.dbo.Search_groupby_view
      (Doc = @txtDocSearch or @txtDocSearch IS NULL or @txtDocSearch = '')
      and (Year = @txtYearSearch or @txtYearSearch Is Null or @txtYearSearch = '')
    and (GorLast like @txtGorLastSearch or @txtGorLastSearch is null or @txtGorLastSearch = '')
      order by Doc

My results form (frmSearchResultsGroubBy) has the data source set to the pass-through query.
In the On Open event I have this:

Private Sub Form_Open(Cancel As Integer)
    Dim intX As Integer
    Dim qdf As QueryDef
    Dim frm As Form

     Set dbsForm = CurrentDb
     Set frm = Forms!frmSearchgroupby
     Set qdf = dbsForm.QueryDefs("qrySQLSearchDocs")

 Dim rstForm As dao.Recordset

qdf.SQL = "EXEC spSearchDocs " & "'" & Forms!frmSearchgroupby!txtDocSearch & "'" & "," & "'" & Forms!frmSearchgroupby!txtYearSearch & "'" & "," & "'" & Forms!frmSearchgroupby!txtGorLastSearch & "'"
qdf.ReturnsRecords = True

Set rstForm = qdf.OpenRecordset()
Set qdf = Nothing
Set frm = Nothing
End Sub

Am I mising something, or is something running in the wrong place?  It is working great, except that my search is running after the fact!
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.

Kelvin SparksCommented:
Is the form bound or unbound. It almost sounds like the control hasn't updated when you clicked the run button - if bound do a saverecord first, if unbound find a way to ensure that the focus has ghone elsewhere first

Kelvin SparksCommented:
Looking at it again. You set the qdf on form open, and then redone the SQL, but not topld it to run again. You need a me.requery after setting the sql

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
dcgimoAuthor Commented:
That is it!  I added the me.requery and it is working now.  Thank you so much!
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
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.