Object invalid or no longer set (1 Viewer)

cdoyle

Registered User.
Local time
Yesterday, 23:48
Joined
Jun 9, 2004
Messages
383
I hope someone can help me solve this random error, that only some users are seeing with my data entry form.

I have a main form that displays the users info.
Then 2 subforms,

The first subform is the data entry form, and the second subform displays all the entries that the user entered today.

The original problem was, that even tho I had the 1st subform set to only show the current record, every once in awhile it would just go back to displaying all records in the DB, stating with the first record. Which confused users, and sometimes they would overwrite the first record not realizing it. I think this problem had something do with our nework, but could never really track it down.

so with some help from another forum, we came up with having the form bound to a temp table, then after entering the data it would then insert the data into the real table, and then delete the data from the temp table.

For the most part this works pretty good, but every once in awhile my users are getting an error. "Object invalid or no longer set " It will send up a ton of these messages on the screen, and they have to end task to get out of the db.

I'm hoping I just have something coded wrong and that is causing it, and I'm someone can help me clean up my code, and it will solve whatever is causing this problem.

Here I have behind the 1st subform.


Code:
Option Compare Database
Option Explicit
Private Sub cbo_category_AfterUpdate()
If Not IsNull(Me.cbo_category.Value) Then
  cbo_category.DefaultValue = Me.cbo_category.Value
End If
End Sub


Private Sub cbo_system_AfterUpdate()
If Not IsNull(Me.cbo_system.Value) Then
  cbo_system.DefaultValue = Me.cbo_system.Value
End If
End Sub

Private Sub Form_Error(DataErr As Integer, Response As Integer)

 If StandardErrors(DataErr) = True Then Response = False
 
 If StandardErrors(Err) = False Then

MsgBox Err & ": " & Err.Description
 End If


 End Sub



Private Sub cmd_add_Click()
On Error GoTo Err_cmd_add_Click
  
    If Me.Dirty Then Me.Dirty = False
      
     CurrentDb.Execute "INSERT INTO analyst_data_TBL(user_ID, Date_Entered, Outcome_ID, system_ID, Pend_ID) SELECT user_ID, Date_Entered, Outcome_ID, system_ID, Pend_ID from TEMP_analyst_data;"
     CurrentDb.Execute "DELETE FROM TEMP_analyst_data;"

    Me.DataEntry = True
    Forms!main_entry_FRM.Todays_Activity_FRM.Requery


Exit_cmd_add_Click:
    Exit Sub

Err_cmd_add_Click: If StandardErrors(Err) = False Then

 MsgBox Err & ": " & Err.Description

 End If

    Resume Exit_cmd_add_Click


End Sub


Private Sub Form_Load()
 CurrentDb.Execute "DELETE FROM TEMP_analyst_data;"
End Sub

The error is only happening to a few people, most people have never had the problem. I myself have never had it happen to me, but I've seen the screenshots from the users it did happend too. They will have the error a dozen or so times on the screen, and the only way to make it stop, is to end task for Access.

If anyone wants to read the thread of my original problem on the other forum, here is a link
http://www.mdbmakers.com/forums/showthread.php?t=22915
 

Users who are viewing this thread

Top Bottom