Wow, there are several things that could cause that.
This sequence addresses several issues that can cause Access to crash:
- name corruptions;
- compilation inconsistencies;
- index corruptions;
- an AccessField bug;
- event queing issues (by explicitly saving);
- narrow typing (in the combo's code);
- reference problems.
Hopefully the combination of all of these will bring you to a stable
database.
1. Uncheck the boxes under:
Tools | Options | General | 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
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, and compact again.
5. Open the OrderDetail subform in design view. Presumably it is linked
to
the main form by an OrderID or a CustID? Whatever the field is called, if
you don't have a *control* by that name in the subform, add it from the
Field list. You can set its Visible property to No, but you just need to
control to avoid an Access but. (AFAIK, this issue affects A2002 and 2003
rather than 2000, but it won't hurt.) Save and close the subform.
6. Open the main form in design view. Right-click the subform control,
and
choose Properties. Delete the entries from the LinkChildFields and
LinkMasterFields. Save.
7. Now to the combo for selecting customers. Make sure there is nothing
in
its Control Source property. Replace any code in its events with this:
Sub CboMoveTo_AfterUpdate ()
Dim rs As DAO.Recordset
If Not IsNull(Me.cboMoveTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.cboMoveTo
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
8. Restore the LinkChildFields and LinkMasterFields properties you
removed
at step 6. (The purpose of this was to ensure Access associates the
LinkChildFields with the control you added at step 5, instead of with the
AccessField type that has the bug.)
9. 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
10. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.
Thank you Allen for responding.
I'm using Access 2000 and the payment form has no subforms.
The crash happens after I select another customer from the combo box
not
before. But, If I navigate forward or backward one customer using the
navigation arrows or scrolling with the wheel on my mouse I can use the
combo
box without any problem. It is almost as if it needs refreshing after
opening
the payment form whether I enter a payment or not but I tried that and
it
still crashes but not if I navigate to another customer using the
navigation
arrows at the bottom of my "Orders by Customer" form or any other
method
to
navigate other than the combo box.
Here is the senario again step by step
1. I am on my Orders by Customers Form and it has a subform showing
order
details.
2. I click on enter payments or double click the payment in the order
details subform to open my payment form.
3. at this point I enter a payment or JUST close the payment form
"Either
one".
4. I'm back at my "Orders by Customer Form. "All is ok at this point"
5. Normally at this point I click in my combo box which is to search
for
customers.
this is where it gets complicated.
A. If I scroll forward or backward then use the combo box all is OK.
B. If I click in the combo box and then use my mouse to scroll at least
one
customer forward or backward all is still OK.
C. If I use the combo box to search for a customer "without scrolling
forward or backwards first" it takes me to that customer then is when
it
crashes.
Here is my After update code for combo box
<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Private Sub Combo53_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Nz(Me![Combo53], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
:
Okay, the crash happens after you enter a payment, and before you
select
another customer on the *same* form?
If so, tell us more about this Payments form:
Any subforms?
Bound to a table? Or to a query?
What code is in the AfterUpdate (?) event of the combo?
What version of Access is this?
Some things to try:
1. Uncheck the boxes under:
Tools | Options | General | 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
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, 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
7. In the AfterUpdate event procedure of the combo, explicitly save
the
record before attempting to move, by adding this line to the top of
the
code:
If Me.Dirty Then Me.Dirty = False
I am using access 2000 and windows XP
I have two forms
"Orders by Customer" & "Payments"
On the "Orders by Customers" when I click to open Payments and enter
a
payment all is ok until I click in my combobox and select another
customer,
It then takes me to that customer and gives me a microsoft error and
says
it
has to close. I am totaly lost.