Microsoft Access says object doesn't exist when compiled to an mde file
Posted on 2007-08-08
I am developing in Access (have tried this on both 2003 and 2007).
I have a main form with a subform, and the subform has a listbox on it.
I've got code in the listbox double click event that is as follows:
Private Sub lstAwards_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmAward", , , , , acDialog
The idea here is that the listbox opens the form frmAward and when that form closes, it requeries the listbox (which is the listbox that was just double clicked). The reason is that the form that opens, frmAward, is a detail form for the information shown in the listbox. If the user changed the name or some of the information shown in the listbox, I want it requeried.
When I run this code (double click on the listbox), the form frmAward opens fine. When I close that form I get the error message:
"The experssion on dbl click you enetered as the event property setting produced the following error: The expression you entered refers to an object that is closed or doesn't exist"
I never close the main form / subform.
This only happens if I create an .mde version of the database. If I run this from the .mdb, it works fine. I've messed around with this code a number of ways. If I remove the acDialog parameter on the form, it goes through fine. If I don't open the form (comment out the docmd.openform line), it requeries the listbox fine.
I am at wits end. Anyone help me figure this out?