Good night, Paul! This could be several things.
What event are you doing this in? A requery could trigger a chain of events
that actually fails somewhere. For example, if you are doing this in the
KeyDown event of a text box, Access has to trigger the controls' Change,
BeforeUpdate and AfterUpdate events, and the BeforeUpdate event of the form
before it can save the record before it can perform the requery, which will
trigger the form's Current event, and probably the Exit and Enter events of
the controls. If anything at all fails in that chain, the message gets
passed back up the chain and you often get a weirdly inappropriate message
as a result.
To avoid the problem, you may need to move the code into a more appropriate
event. I find it also helps to pin down where the error really lies if you
explicitly save the record first, e.g.
If Me.Dirty Then Me.Dirty = False
Another possible cause of Access's confusion about the names of things is
Name AutoCorrect. Disable it, and compact the database. More info:
http://allenbrowne.com/bug-03.html
Another possible trigger is the kind of corruption that a decompile fixes.
To decompile, make a backup of the database, and enter something like this
at the command prompt while Access is not running. It is all one line, and
include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"
Removing unnecessary references, and using Option Explicit can also help to
track down the cause.
There is also a bug that triggers this error if you are adding a new record
in a form that is based on a multi-table query some fields of the table you
are not adding a record to have a Default Value specified.
Hope that helps you to pin it down.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"PW" <pa********@removewilliamsonenterprises.comwrote in message
news:o5********************************@4ax.com...
>
What the heck is that supposed to mean? I am getting this error on a
"Me.Requery" line in a subroutine on a form, but only when I select
something from a combo/dropdown box. The *exact* same code is run when
I do other things (like press the Save button or tab through that
control).
I have searched every control, involved queries and tables and I can't
find anything that looks fishy.
Any ideas?
-pw