Access ADP subform refreshes / fickers as many times as rows in the datasheet it contains

I have a main form and a subform. In the OPEN event for the subform the code  below is executed.  The subform displays the results in datasheet format. There are no Master / Child links. The LogonID stored on a hidden & minimized form is used to retreive the rows in the SavedActivity table. The stored procedure has 1 parameter, @UserID, which is the primary key for the table.

The resulting recordset produces exactly what I want; but when the focus is placed on the subform when a staffer clicks on any  row on the subform, the datasheet in the subform "flickers / refreshes" about as many times as the number of rows returned.  This "refresh" happens only the first time any row is clicked on or the scroll bar moved. After a staffer posts the updated row, then the problems reoccurs again.

The "refreshs" can take a long time to finish compared to the 1 - 2 second time it takes for the form to display the results.  I do not invoke any refresh / requery / repaint methods.

I have tried playing with every setting I could find, but I  don't know causes the problem or how to fix it.

Could someone please help?
   Dim strParm As String
   strParm = "Execute  stpSavedActivity_ByID  '" & Forms![frmSetup01]![LogonID] & "'"
  Me.RecordSource = strParm

Who is Participating?
Leigh PurvisConnect With a Mentor Database DeveloperCommented:

Sunny Sunday afternoon here - so what better time to answer ADP questions :-)

The behaviour you're seeing is obviously not by design.
And you're absolutely sure you have no refresh/requery/recalc commands anywhere present in either form?  (Recalc in particular can be an absolute *pain* for doing this kind of thing).

Does this same behaviour happen when the recordsource is assigned to the subform by a more umm.. traditional method?
For example directly assigning an SQL statement to it?
(OK not as fast in theory - but we're looking for culprits here).

Do you have other forms using the method you describe?  In particular other subforms?

What about other methods.
For example

  Me.InputParameters = "'" & Forms![frmSetup01]![LogonID] & "'"
  Me.RecordSource = "stpSavedActivity_ByID"


  Set Me.Recordset = CurrentProject.Connection.Execute("EXEC stpSavedActivity_ByID  '" & Forms![frmSetup01]![LogonID] & "'")

Any different?
Jeffrey CoachmanMIS LiasonCommented:

Could this have anything to do with one of the "Advanced" "Interval" setting being set to low?
Refresh Interval
ODBC Refresh Interval
(Either one of these being set to 1 or Zero)

Forcing Access to "Refresh" too soon/often?
Leigh PurvisDatabase DeveloperCommented:
I wouldn't have expected so to be honest.

You can check the OLE timeout and the refresh interval (any ODBC settings will - or at least should - be absent in an ADP).  But I don't think they'd affect the ADP's normal use. (They should be the normal sort of 30/60 seconds... worth a quick check of course).
But for this to be happening only on entering the subform - doesn't sound like a constant interval problem as such.

It looks like this might become a "no feedback" type question - but I'd certainly wonder about the other methods of assigning the source for now.

And if there really is no refresh/requery code - then I wonder what happens if you actually put some in?
It does it - but still visibly requeries upon entry again?
hwr734sAuthor Commented:
Sorry I did not respond sooner. A co-worker resigned and I had to work on transitioning his work to me.

I did try  your suggestions, but with mixed results.

I was so frustrated, I decided to make a copy of the file and start over.  I deleted ALL events on the main form and subform and added one event back at a time. When I got it to work properly, I compared the two  VBA event files.

The culprit turned out to be the "Enter" event on main form. Some input parameters on the  properties sheet  left over from my multiple attemps to pass the parameters to the stored proceedure caused the subform to  refilter the data again when the subform datasheet got the focus.

I can not even find an "Enter" event on any properties sheet, but it showed up in the VBA editor.

A check in HELP on "Events" turned up this: "Because the Enter event occurs before the focus moves to a particular control, ..."; so i presume that after processing  the "Execute  stpSavedActivitySelected  '" & Forms![frmSetup01]![LogonID] & "' , 'T' "  when the update button on the main form was pressed, a second query was triggered by the "Input parameters"  data.

Again, I apologize for the tardy response.
In summary, either the:
        Me.InputParameters = "'" & Forms![frmSetup01]![LogonID] & "'"
        Me.RecordSource = "stpSavedActivity_ByID"
       strParm = "Execute  stpSavedActivity_ByID  '" & Forms![frmSetup01]![LogonID] & "'"
        Me.RecordSource = strParm

would have worked alone, but not the two together.; which is in essence is what I had by the Data tab "Input Parameters" variables coded.

I am awarding you the points, and appreciate your help

Leigh PurvisDatabase DeveloperCommented:
Enter is an event of the subform control itself - rather than the underlying form acting as a subform.
(On the parent form the subform control has only two events - Enter and Exit - as well as the plethora that exist for the form itself.)

Ultimately - it was something firing in one of the events as the subform receives focus.  (Just not where you expected ;-)
Which is reassuring as the first thing that iccurs in such a situation.

Glad you're sorted.

(P.S. Any of the suggested methods should work well by themselves under normal circumstances)
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.

All Courses

From novice to tech pro — start learning today.