Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Fri Jan 25 07:35:43 CST 2008
That's great! I've been having this error in an app - random. Maybe from keyboard bounce? Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, January 25, 2008 12:59 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] The expression you entered refers to an object that isclosed or doesnt exist. How many of you have come across that error? I have a system where the user selects some criteria, then a form is opened using that criteria. There is a command button that is the "default" button (clicked if the user hits enter) which loads the form, so the user can either click the button with the mouse or just hit enter. I was getting "The expression you entered refers to an object that is closed or doesn't exist." very occasionally as the form opened. I finally discovered that if I tapped the enter key several times as the form loaded, Access sensed TWO key clicks and thus tried to open the form a second time. I got rid of the error with the following code: Private Sub but_wrksht_Click() On Error GoTo Err_but_wrksht_Click Static blnOpening As Boolean If blnOpening Then Exit Sub blnOpening = True OpenClaimFrm blnOpening = False Exit_but_wrksht_Click: Exit Sub end sub As you can see, I create a static variable, set it to True as I pass through the first time and clear it again as the OpenClaimForm() finished. If the click event is sensed a second time while the OpenClaimForm() is still processing, the blnOpening is still true and the sub is exited. What a PITA Access is sometimes. John W. Colby Colby Consulting www.ColbyConsulting.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.11/1242 - Release Date: 1/24/2008 8:32 PM