Link to home
Start Free TrialLog in
Avatar of jmiller56
jmiller56

asked on

DAO recordset problems

I am developing an mdb application with considerable VBA behind some fairly involved forms/subforms.  The version is Access2000.

I an earlier version of this system, everything worked fine.  But now I have the following problem for some reason:

In subform B, I have a field with an "AfterUpdate" handler.  In this handler I create a reference to subform A, and I create a handle to subform A's bound recordset (not clone).  A total from subform B is put into this recordset.

Problem:  When I try to access the recordset (.edit), I get an error.  The .absoluteposition of this rst is -1 (should be 0 to (RecordCount-1)).  This works in my previous version, but for some reason in my current version, the absoluteposition value of -1 indicates that either the recordset does not support this function, or it doesn't exist.  I believe it exists.  It is a regular dynaset, and I the form.CurrentRecord is 1 (first record).

This only happens when I first open the form and the record selected is the first one in subform A.  After I move to a different record (manually), this issue disappears and all works well.

Any ideas why this would be happening?

thanks,

Joe
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Joe,

  Most likely, it's some sort of a timing issue.  You have background operations that are taking place which have not as yet completed.

  In subforms B's AfterUpdate event, try adding a:

  dbEngine.Idle dbRefreshCache
  DoEvents

  See if that makes a difference.  If not, please explain in more detail what you mean by:

"In this handler I create a reference to subform A, and I create a handle to subform A's bound recordset (not clone).  A total from subform B is put into this recordset.
"

  actual code would be good.

Jim.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial