Thank you very much for all of your suggestions.
The AutoCorrect boxes were checked and I removed them.
The compact and repair, decompile and compile, and importing into a new
database all executed successfully.
But the problem still exists.
I'm using Access 2000.
I have a few buttons on the Sales Order form that the user can use to
find
information. It seems that sometimes when they click on these and
return
to
the SO form, the link is lost between the SO and payment subform. The
current SO is fine but the payment shows #error or "invalid bookmark".
I don't have any Timer or BeforeInsert or Form events.
When an information button is clicked, I do a command to save the SO.
Then
I
open another form where they choose the information they need (ex a
customer
or product), copy the info to the SO and close the info form. At this
point
the payment shows #error - sometimes.
I'd appreciate any other ideas - thanks
:
A decompile might help. Also make sure Name AutoCorrect is off.
Details
below.
There are several other things that could affect this, depending on
what
events you are using. Suggestions:
- Temporarily remove anything you have in the form's Timer event.
- Be suspicious of anything in keystroke or mouse move, especially if
it
requires moving record.
- Explicitly save before anything that necessitates a save (e.g.
moving
record, filtering, sorting, requerying, closing form, ...)
- Don't dirty a form unnecessarily (e.g. don't write to any bound
control
in
Form_Current or Form_AfterUpdate.)
- Cancel the subform's BeforeInsert event if the main form is at a new
record.
- Remove the zero default value in your foreign keys (in table
design),
and
consider setting their Required property to Yes (e.g. if there should
not
be
a payment that isn't tied to a sales order.)
- If you OpenRecordset, be sure to Close, and set your object
variables
to
Nothing before exiting that routine.
And here is a standard sequence to fix a problem database. Try it in
order:
1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
In Access 2007, it's:
Office Button | Access Options | Current Database | Name
AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html
2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact/Repair
or in Access 2007:
Office Button | Manage | Compact/Repair
3. Close Access. Make a backup copy of the file. Decompile the
database
by
entering 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"
4. Open Access (holding down the Shift key if you have any startup
code),
and compact again.
5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access,
see:
http://allenbrowne.com/ser-38.html
6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.
At this point, you should have a database where the name-autocorrect
errors
are gone, the indexes are repaired, inconsistencies between the text-
and
compiled-versions of the code are fixed, reference ambiguities are
resolved,
and the code syntax is compilable.
If it is still a problem, the next step would be to get Access to
rebuild
the database for you. Follow the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html
I have a mainform for a sales order that has a subform for the sales
order
details and a subform for the payment (A customer can pay by more
than
one
method for a sales order) It all seems very simple but sometimes
when
the
user has entered the sales order and then enters a new record in the
payment
subform, the message "Invalid Bookmark" is displayed. Sometimes the
message
is that the "record is locked and is being used by another user."
It
isn't
consistent. I have done a Compact and Repair many times on the
program
and
the back-end data. I downloaded a program that does a more thorough
repair.
I have recreated my forms, the tables and all the indexes. Nothing
has
helped. Any help I information I can find has to do with coding for
the
bookmark in the modules. I don't have any. Has anyone had this
problem
before or know of anything else I can try? Thanks.