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

Posted on 2006-07-07
Medium Priority
Last Modified: 2008-01-09
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

Question by:hwr734s
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 44

Accepted Solution

Leigh Purvis earned 2000 total points
ID: 17067742

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?
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 17105334

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?
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17106235
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?

Author Comment

ID: 17122201
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

LVL 44

Expert Comment

by:Leigh Purvis
ID: 17122353
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)

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question