• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

How can I refresh a form without refreshing the subforms that are contained on it?

Hi experts,

Is it possible to refresh a form without refreshing the subforms contained on it?  Basically, when I requery or refresh my form the subforms blink once as if they are refreshing.  I do not need this to happen as the subforms are only on there for extra information and not part of the same record, i.e. the subform information is static and the recordsource is from another table. Please could somebody help me to not refresh these subforms?  

At the moment, on my form that has the subforms on it, I click a button to refresh the data on the form, in effect this refresh saves the data to the table.  When I click this button the subforms blink as if they are updating, but this is not required.

I have tried both me.refresh and me.requiry but neither have stopped the subforms from blinking once.

Any help would be gratefully received. Thank you.

Regards,
Terry
0
TerenceHewett
Asked:
TerenceHewett
  • 3
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
This is default behavior, and you really cannot tell Access to ignore the subforms. You can, however, "lock" the screen so it doesn't update until you tell it to. Use this:

In the General Declarations section of a standard Module (i.e. not a Form module):

Declare Function LockWindowUpdate Lib "user32" (ByVal hWnd As Long) As Long

Now, anywhere you need to turn screen updating off:

LockWindowUpdate Me.hwnd

To turn it back on:

LockWindowUpdate 0
0
 
TerenceHewettAuthor Commented:
Thanks LSM for the code above.  I think this is exactly what I need but I have tried this code in the OnOpen, OnLoad, OnCurrent events of the form and I still have the same issue.  I did put the Declare... code into the General Declarations of a standard module.

Any ideas where this code should be executed?

Thank you again.

Terry
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You would usse this just before you requery:

LockWindowUpdate Me.Hwnd
<do your requery>
UnlockWindowUpdate 0
0
 
TerenceHewettAuthor Commented:
LSM, you are a genius - thank you very much - this has resolved my problem.

Best regards

Terry
0
 
TerenceHewettAuthor Commented:
Sorry LSM, thought I had accepted this solution.  

Best regards
Terry
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now