jwcolby
jwcolby at colbyconsulting.com
Fri Jan 25 11:12:30 CST 2008
Love those goodie bags. 8-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim Sent: Friday, January 25, 2008 11:33 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] The expression you entered refers to an object thatisclosed or doesnt exist. This one goes in the goody bag, Thanks John. Jim Hale -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, January 25, 2008 2: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 *********************************************************************** The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer. As a recipient of this email, you are responsible for screening its contents and the contents of any attachments for the presence of viruses. No liability is accepted for any damages caused by any virus transmitted by this email. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com