Hi Crystal,
I don't have a Close button - I was just clicking the closedown cross in the
corner. So I put your code in the Close Event of the form. I still got the
warning, then when I dismissed that I got the following error message:
Run-time error '2501':
You used a method of the DoCmd object to carry out an action in Visual
Basic, but then clicked Cancel in a dialog box. For example you used the
Close method to close a changed form, then clicked Cancel in the dialog box
that asks if you want to save the changes you made to the form.
When I clicked the Debug button on the dialog, I found the code had halted
at your line. I tried changing 'SaveNo' to 'SaveYes', but still got this
error 2501.
I never get a dialog box asking me to save changes, but that could be
because I have unchecked that option. So I checked it but still didn't get
that dialog.
Finally I added my own Close button and put your code in it. That works
without showing an error. However I don't want to have to remember not to
use the normal closedown cross.
Dave W
----- Original Message -----
From: "crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals]"
<MS_Access_Professionals@yahoogroups.com>
To: <MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, June 17, 2015 7:30 PM
Subject: Re: [MS_AccessPros] Win98 "The object is locked" message
> Hi Dave,
>
> try this code for the CLOSE button on your form:
>
> DoCmd.Close acForm, me.Name, acSaveNo
>
> Warm Regards,
> Crystal
>
> How To Make a Graph with Microsoft Access (cc)
> http://www.youtube.com/watch?v=YhgNX6BWWmk&list=PLis0tV85b5t6TuFPTldPF-Ra67As6-Rj0
> - Create chart, change what data is displayed including formatting,
> chart type, titles and legend
>
> ~ have an awesome day ~
>
> On 6/17/2015 8:18 AM, 'Dave W' davewi11@yahoo.co.uk
> [MS_Access_Professionals] wrote:
>> I have a form containing a graph and text-boxes. I have code for various
>> mouse events on the graph, which is an "OLEunbound" object. When I close
>> the
>> form without even touching the graph, I get the warning message:
>> "The object is locked, so any changes you make will be discarded when the
>> form is closed."
>>
>> If I have operated the mouse events, or even just set the focus on the
>> graph, the form exits without the message. However I don't want to set
>> the
>> focus on the graph because it gets a black border, and the grid lines
>> display on top of buttons that are normally on top of the graph.
>>
>> I can avoid the message by setting the graph properties to disabled and
>> locked, but then I can't operate the mouse events.
>>
>> I've tried adding code to the form's close-event but to no avail.
>>
>> The warning occurs in Access 97 on Windows 98 but does not occur on XP,
>> with
>> or without converting to Access 2003 format. I have trawled the forums;
>> others have had the same message but nobody has any suggestions other
>> than
>> disabling the graph or giving it the focus.
>>
>> Can anyone suggest a way of preventing the warning?
>
>
------------------------------------
------------------------------------
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)
<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
Tidak ada komentar:
Posting Komentar