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
--
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.
"ggregg" <ggr...@discussions.microsoft.com> wrote in message
news:8C6CC950-30F1-4FF3...@microsoft.com...
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
To investigate if this is so, open the Immediate Window (Ctrl+G) once it
fails, and ask Access if the link is intact. Enter questions such as:
? Forms![Sales Order]![Sales Order ID]
? Forms![Sales Order]![Payment subform].LinkChildFields
Naturally you need to use the actual form, field, and subform names in those
expressions.
If you can't identify what's going wrong, post the code from one of the
command buttons that triggers the error.
--
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.
"ggregg" <ggr...@discussions.microsoft.com> wrote in message
news:0ABFC589-C74A-4200...@microsoft.com...
I have entered the command to refresh the Sales Order form after an
information form has been opened and closed. This has helped over the last 2
weeks. The error still happens but not very often and sporatically. I think
the "invalid bookmark" error may be a symptom of something else.
Thank you for all your help
--
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.
"ggregg" <ggr...@discussions.microsoft.com> wrote in message
news:3DB30E0C-C319-4837...@microsoft.com...
There has to be another factor in there, probably associated with the code
behind the buttons that trigger the problem.
--
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.
"ggregg" <ggr...@discussions.microsoft.com> wrote in message
news:DA503D82-9601-4349...@microsoft.com...