Re: Closing Form Produces "Runtime Error 2585"
From: Kevin Rodriguez (anonymous_at_discussions.microsoft.com)
Date: 05/25/04
- Next message: Cheryl Fischer: "Re: Create email from code - Help"
- Previous message: Graham Mandeno: "Re: Syntax Error"
- In reply to: Graham Mandeno: "Re: Closing Form Produces "Runtime Error 2585""
- Next in thread: Graham Mandeno: "Re: Closing Form Produces "Runtime Error 2585""
- Reply: Graham Mandeno: "Re: Closing Form Produces "Runtime Error 2585""
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 25 May 2004 16:26:06 -0700
I agree with you on the calculated full name. It's a legacy item that I have to work with for the time being. I'll remove this blight on my data model later.
I tried the "DoCmd.Close acForm, Me.Name" and it didn't work.
I then tried "DoCmd.Close acForm, Screen.ActiveForm" and got runtime error 2475 - You entered an expression that requires a form to be the active window. So your thought is right. Perhaps the focus is changed before the form is closed. It's just a rookie guess and I don't know how or why this could happen. I continue to be baffled.
----- Graham Mandeno wrote: -----
Hi Kevin
DoCmd.Close can behave asynchronously and works on the form which currently
has the focus, so I suspect what is happening is that sometimes you are
attempting to close the MainMenu form while it is in the act of opening.
Always specify what you want to close:
DoCmd.Close acForm, Me.Name
I see you say you have already tried this, but try it again anyway :-)
My main concern is that you should NEVER store an easily calculatable entity
such as Full Name like this. It is so easy to make a query with a
calculated field to give you the Full Name from its component parts as and
when you need it, and in the format required for the purpose.
I recommend you remove the Full Name field from your table.
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
"Kevin Rodriguez" <anonymous@discussions.microsoft.com> wrote in message
news:93969617-8941-44D4-B222-D92C63D46BC8@microsoft.com...
> I have a procedure that runs on Click from a form. The code, in brief:
>> DoCmd.RunSQL "UPDATE Contacts SET Contacts.[Full Name] = [LastName] &
', ' & [FirstName] & ' ' & [Title]"
> DoCmd.Close
> DoCmd.OpenForm "MainMenu"
>> I'm getting the above referenced error (error message: This action can't
be carried out while processing a form or report event), but not all the
time. I can't figure out what is going on to have the error come up
randomly. I've tried to run it without the SQL statement before the close,
it still fails. I've been explicit including "acForm, <FormName>" on the
DoCmd, it still fails. I'm at a loss.
>> I'm a novice and wondering if I set one of my properties incorrectly, or
what ever...
- Next message: Cheryl Fischer: "Re: Create email from code - Help"
- Previous message: Graham Mandeno: "Re: Syntax Error"
- In reply to: Graham Mandeno: "Re: Closing Form Produces "Runtime Error 2585""
- Next in thread: Graham Mandeno: "Re: Closing Form Produces "Runtime Error 2585""
- Reply: Graham Mandeno: "Re: Closing Form Produces "Runtime Error 2585""
- Messages sorted by: [ date ] [ thread ]