Annoying Sub-form refresh

  • Thread starter Thread starter Algis Kuliukas
  • Start date Start date
A

Algis Kuliukas

I have a wierd problem in Access forms which has been driving me mad.

You have a form with a sub-form (this may or may not be part of a
tab-control). The user is entering data into the main form and then into the
sub-form. Everything is fine until ocassionally - about once a minute - the
subform appears to re-query itself automatically and the focus, wherever it
was, whatever the user was doing, is now in the first field in the subform.
Consequently if the user does not notice they will continue typing,
overwriting the first fields.

If played around with the query refresh and ODBC refresh database options to
no avail. There's no code in the OnTimer event. I suspected a virus but it
seems to do the same thing on several machines we've tried it on.

Any help would be greatly appreciated.

Algis Kuliukas
 
Check the OnCurrent event for your subform and make sure
you aren't asking it to do something every time you go to
a new record. You may also want to look at the OnDirty
and BeforeUpdate events.

Does this happen when you enter a certain field or is it
totally random?

If it is totally random I would expect some sort of
corruption in the form. I have many subforms and they
never requery without me telling them to.

Sometimes subforms get messed up for some reason. When
that happens I just delete the subform, save the parent
form, close it then reopen it and add the subform again.

You may also try compressing and repairing the database.

Last option would be to run a debug on your modules.
Sometimes you can have a bug somewhere in your code ,
like two functions with the same name, that has effects
you might not expect.
 
Hey, thanks Bill for your attention.
Check the OnCurrent event for your subform and make sure
you aren't asking it to do something every time you go to
a new record. You may also want to look at the OnDirty
and BeforeUpdate events.

Nothing in the OnCurrent event of the subform. The subform has only one line
of code in it - to change the default value of a field once it has been
updated.
There is various code in the OnCurrent event of the main form but nothing
that refers to the subform.
Does this happen when you enter a certain field or is it
totally random?

Perhaps I should have added this to the problem description...

One the subforms that have this problem it is entirely repeatable. You can
put the cursor in one of the fields in the subform havig just openned the
form and just sit and stare at it. After about 60 seconds the screen will
kind of flicker as if someone has pressed F9 or <shift>F9 and the cursor
will move to the first field in the subform - every time.

So, no, it's not random but it's not related to any particular field.
If it is totally random I would expect some sort of
corruption in the form. I have many subforms and they
never requery without me telling them to.

Yes I've developed hundreds of Access systems and never had this before.
This is Access 2000 but I have the same problem in a seperate Access XP
system. I've never known the problem in earlier releases.
Sometimes subforms get messed up for some reason. When
that happens I just delete the subform, save the parent
form, close it then reopen it and add the subform again.

I've just tried doing that (again) and it still does it.
You may also try compressing and repairing the database.

I've tried that too.
Last option would be to run a debug on your modules.
Sometimes you can have a bug somewhere in your code ,
like two functions with the same name, that has effects
you might not expect.

Sorry. What do you mean 'run a debug'? You mean do a Compile all modules?
I've done that.

So thanks, but it still the same problem. Irritating the user no end and
very embarassing for me that I can't fix it.

Algis Kuliukas

 
Are you absolutely certain you dont have a timer event hidden away somewhere
on an active form ?

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
Back
Top