This code, as you've concluded, should not be a source of the error. It's
possible that the compiled code has become confused in the form's module. Or
that the form has become corrupted.
When you deleted this procedure, did you close the form (saving the changes,
of course), and then do a compact/repair on the database? If not, try that
(keep copy of the procedure that you delete). Then put the procedure back
into the form's module (tie it to the OnCurrent property via [Event
Procedure], of course). See if that eliminates the problem.
If it doesn't you might try importing the form into a new database and
delete it from the current database. Compact/repair the current database.
Then reimport the form from the new database back into the original
database.
If these don't work, post back and we'll see what other options we might
try.
--
Ken Snell
<MS ACCESS MVP>
Don Starnes said:
Ken--
I managed to delete the proceedure that I had been working on when this
happened and made the error go away. But when I add the proceedure
back
in, I
get the error again after I navigate to the next record. The offending
proceedure is:
Private Sub Form_Current()
' when the form goes to a new record:
' requery the groups control
Me.groups.Requery
' select the first item in the groups control
Me.groups.Selected(0) = True
End Sub
"controls" is a listbox whose recordset is a query as a SQL statement. The
query has as a criteria a field on the form that is bound to a field
in
the
form's current table.
How is this proceedure giving me that error? What is wrong with this
proceedure?
Thanks!
:
Somewhere in code that is running is an Update statement for a recordset
that doesn't have an AddNew or an Edit statement preceding it in the code.
Likely inadvertent commenting out of some code lines, or accidental deletion
of some code lines.
Do a "Find" for the text string ".Update" in your modules and see if
you
can
find the offending code snippet.
--
Ken Snell
<MS ACCESS MVP>
I was editing a proceedure for a form and I started getting this error
when I
attempt to navigate on my form in any way.
The proceedure (current) simply requeried a listbox and then set it's
selected property. When I commented out the lines in the proceedure or
even
deleted the proceedure, the error wouldn't go away.
What causes this error?