Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Question

Status
Not open for further replies.

SDS100UK

MIS
Jul 15, 2001
185
GB
Hi,

Access XP

I have a db that has the refresh instruction on the forms timer event.

The problem is that if a user happens to be typing in a text box when the refresh happens, the whole of the text becomes highlighted and on the next keystroke, of course disappears.

Any ideas as to:-
1)Why this is happening
2)How to stop this from happening

Many thanks in advance


Steven
 
Do the Refresh in a more controlled manner.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
One option would be to call a sub each time you want to refresh (ie. based on the timer) which will refresh all controls except for the current one.

eg. create a module and include this code -

Code:
Public Sub RefreshForm(Form As Form)
  Dim ctrl As Control
  
  For Each ctrl In Form.Controls
   If Not (ctrl.Name = Form.ActiveControl.Name) Then
    ' Controls such as labels can't be refreshed, so will throw up errors.
    ' Instead of testing if the control is a label or whatever,
    ' just ignore the error.
    On Error Resume Next
    ctrl.Refresh
    On Error GoTo 0
   End If
  Next
End Sub

Then, if the timer is on the form that is to be refreshed use the code
Code:
RefreshForm Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top