Endless Object no longer set or is invalid Error

  • Thread starter Corey-g via AccessMonster.com
  • Start date
C

Corey-g via AccessMonster.com

Hi All,

I seem to be stuck here, and I can't figure out why...

FE - Access 2K3 (11.6566.6568) SP2
BE - Oracle 10g R2
Linked tables using ADOX

I have a form called frmProc_Main - on this is a tab control with 2 pages,
and both pages have the same subform as the source object (with different
'Link Master Field' values). These both appear to work for the first time
through. The query for these subforms restricts records based on a value
'normally' accessed from a class module. But I read that you can't use a
class module variable in a query, so I created a module level function to
return this value (and set it to a static number for testing purposes). And
it seems to work for the first time the form is opened. In the footer of
these sub-forms there is a button that opens a second form - frmProc_Order -
that contains 2 subforms (in continuous form view). Again, the datasource
for these 2 sub-forms is the same query (not the same query as the first form)
, but show different data based on the master / child link fields. There is
a button in the first subform that modifies that record to meet the criteria
for the second sub-form. When I press this button, the code works and the
data is changed in the database, but when it attempts to 'recalc', I get the
following error:

"This expression is typed incorrectly, or it is too complex to be evaluated.
For example, a numeric expression may contain too many complicated elements.
Try simplifying the expression by assigning parts of the expression to
variables."

Then I go into the endless loop of this error message:
"Object invalid or no longer set".

the only way to stop this is to kill the msaccess.exe process - not very good.
..

The code that casues this error (as highlighted in the code window) is:

Public Function GetUserId() As Integer
' function to returnt he current user_id - Used because you cannot refer to a
class
' variable from a query, but you can call a function to return the value...
GetUserId = 1 'CurrentUser.LIPSUserID ' 1 - use for testing
' The class module function is the "CurrentUser.LIPSUserID" field currently
commented out testing
End Function

But this code works fine for the first time the forms load, as I step through
to debug it.

Any thoughts or suggestions would be greatly appreciated...

Thanks,

Corey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top