Command Buttons Not Responding on First Click

Using Access 2003.

Very simple, I have a command button to close the form.  Code is as
follows (form is called "Select212Form")

Private Sub btnMenu_Click()
On Error GoTo Err_btnMenu_Click

    DoCmd.Close acForm, "Select212Form"

Exit_btnMenu_Click:
    Exit Sub

Err_btnMenu_Click:
    MsgBox Err.Description
    Resume Exit_btnMenu_Click

End Sub

The button does nothing the first time it's clicked.  Next time, I
click it, it works!  It's not a double-click, there is a pause between
clicks.  If I put a breakpoint in there, it enters the routine on the
first click and closes the form as it should.  Anyone every seen this?

0
thomas
10/17/2007 7:22:42 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
1046 Views

Similar Articles

[PageSpeed] 37

Is it possible that the form could have unsaved edits that are effecting 
things here?

Try replacing:
    DoCmd.Close acForm, "Select212Form"
with:
    Debug.Print Now() & " - attempting to close " & Me.Name
    If Me.Dirty Then Me.Dirty = False
    DoCmd.Close acForm, Me.Name

If that works, you can remove the Debug.Print line.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<thomas.b.mann@gmail.com> wrote in message 
news:1192648962.158260.268240@i38g2000prf.googlegroups.com...
> Using Access 2003.
>
> Very simple, I have a command button to close the form.  Code is as
> follows (form is called "Select212Form")
>
> Private Sub btnMenu_Click()
> On Error GoTo Err_btnMenu_Click
>
>    DoCmd.Close acForm, "Select212Form"
>
> Exit_btnMenu_Click:
>    Exit Sub
>
> Err_btnMenu_Click:
>    MsgBox Err.Description
>    Resume Exit_btnMenu_Click
>
> End Sub
>
> The button does nothing the first time it's clicked.  Next time, I
> click it, it works!  It's not a double-click, there is a pause between
> clicks.  If I put a breakpoint in there, it enters the routine on the
> first click and closes the form as it should.  Anyone every seen this? 

0
Allen
10/18/2007 6:20:09 AM
I have tried both of those things:

if me.dirty then me.dirty=false

as well as using Me.Name as opposed to "Select212Form"

This form is not even data bound.

However, when I just change the code to simply say:

DoCmd.Close

it seems to work just fine!!


0
thomas
10/18/2007 6:32:06 PM
Reply:

Similar Artilces:

How do I put input boxes and sumbit buttons in?
How do I put input boxes and sumbit buttons in excel vba? I am trying to make a address book manually using Excel VBA. Is there a way I can record multiple information into Excel after submitting info. All i have so far is being able to submit one bit of information into excel but I dont think it will stay if I save it. Like is there a way I can group multiple address information using excel VBA? If so how? What you want to do is not clear. Please post back and give us a step-by-step procedure of what you want to do and what you want Excel to do. HTH Otto "mikstr14" <m...

Where the cursor starts after clicking no a text box
Hello, I have tried looking through the other threads but have not seen the answer to my question. Hopefully someone can help with this today. I have a simple form I made for a table to collect customer info for a mailing list. This form is used like a kiosk at trade shows. Anyway, when you click on any fields that are numbers such as zip codes or phone numbers, the cursor starts in the text box where you clicked. Is there a way to make the cursor start on the left side no matter where the user clicked? Please help ASAP as I have a show tomorrow and am pulling out my hair trying to fin...

print preview command in Excel
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) I just upgraded to office 2008 for Mac and can not find the &quot;print preview&quot; command in Excel I had in my previous version and that is available in Word 2008. Was it removed? > On 11/4/09 8:43 AM, in article 59b7feef.-1@webcrossing.caR9absDaxw, <br> > &quot;sprint1005@officeformac.com&quot; wrote: <br> > <br> > > Version: 2008 <br> > > Operating System: Mac OS X 10.6 (Snow Leopard) <br> > > <br> > > I just upgraded to office ...

macros will not assign to buttons
Help! I cannot assign macros to my custom buttons. The dialog box appears and I can select a macro but it does not save to the button. I believe this is related to another problem I had - which was my personal.xls file did not load on start even though it was in the xl start folder. I fixed that - it was disabled by excel which I fixed by going to about excel - disabled files and selecting enable. Now personal.xls loads - but the macros will not assign. What type of button? From Tools>Customize>Commands>Macros? These customizations are stored in a file named Excel(x).xlb wher...

why is Word "not responding" whenever I try to print?
I have Windows 7, and a new HP Windows 7 compatible printer that was working fine for about a month. Now it will print pages off the internet, and will copy, but will not print when I open a word document saved on my computer - it says it cannot find the printer and then freezes up. See http://word.mvps.org/FAQs/AppErrors/ProblemsStartingWord.htm. -- Stefan Blom Microsoft Word MVP "bellringer" wrote: > I have Windows 7, and a new HP Windows 7 compatible printer that was working > fine for about a month. Now it will print pages off the internet, and...

Which of this events is raised first?Inspector_close or mailitem_close?
The mail item has to close before the Inspector can close. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginners Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mat" <replytogroup@fuckSpam.COM> wrote in message news:#j0SzaSuDHA.2352@TK2MSFTNGP09.phx.gbl... > > ...

contact page to be the first page I see when I open outlook #2
How can I get my main contact page to be the first page I see when outlooked is opened? Thanks Why don' t you ask someone in an Outlook users group. This is an Excel users group.. "JLebron" wrote: > How can I get my main contact page to be the first page I see when outlooked > is opened? > > Thanks Or, if you thought to use Help in Outlook you would find this info. Start Outlook showing my Calendar, Contacts, or Tasks On the Tools menu, click Options. Click the Other tab, and then click Advanced Options. Under General Settings, next to the Startup i...

ESEutil commands
I need a step by step guide on using eseutil. I need to learn how to use this tool to commit the logs to the database On Tue, 23 Nov 2004 18:09:02 -0800, "Ed" <Ed@discussions.microsoft.com> wrote: >I need a step by step guide on using eseutil. I need to learn how to use this >tool to commit the logs to the database eseutil/? A full online backup of the store will commit the logs. What exactly are you trying to accomplish? I have another site that will not have a backup solution in place until next month so i would to know how to flush the logs using this utility ...

Creating custom buttons #2
Hello, I would like to create screens of buttons so that the operators of the register can simply press a button to add an item for a sale. The system will be used at the end of a cafeteria type food line and I need to speed up the check out process. What I am thinking is having 3 buttons on one screen, Hot Food, Drinks, and Candy/Snacks. Then when the cashier presses Hot Food, another screen comes up that displays 1 button for each of the 16 current Hot Food items. When 1 of those items is selected, the Hot Food button screen should remain open until the user presses a Back button. ...

Command Button #4
I'm trying to create a command button to clear filters in my spreadsheet. I don't know how to write the commands, but can recored a macro and run it fine. I tried pasting that macro into the button....and I had it working then messed it up. Now when I click on the button, nothing happens. The code currently associated to the button is below. I really don't want Criteria1 to = 'Reject', but the one time the button worked if no filter was set and the button clicked, an error was returned. The only way I could make it work was to force a filter as part of the macro. How...

command
how do you use command. A lot of computer people use it but how do we use it? Aaron You've reached a newsgroup dedicated to supporting the use of Microsoft Access, a relational database product. I don't see anything in your post that suggests you are asking about MS Access. Please post to a newsgroup that supports the area covered by your post. Regards Jeff Boyce Microsoft Office/Access MVP "aaron" <aaron_t_d@hotmail.com> wrote in message news:78CB1423-55B3-40A1-8BF5-D4615E816057@microsoft.com... > how do you use command. A lot of computer people use i...

Set Increment on Spin Button to 0.1
I'm using a spin button from the control toolbar to increase the value in a cell. the min value i want is 0 the maximum is 2 but i want it to increase by 0.1 in the properties this doesn't seem to be allowed help!!!! Thanx Mark Mark, Here is one way. Link your spinbutton to an unused cell (I use) A15. Set the max to 20. Then in code, set the real cell's value like so Private Sub SpinButton1_SpinUp() Range("A16").Value = Range("A15").Value / 10 End Sub Private Sub SpinButton1_SpinDown() Range("A16").Value = Range("A15").Valu...

Clicking link minimizes Excel
Hi, This may be a really newbie question, but I haven't been able to find the solution on my own and am hoping someone here can help. Whenever I click a link to a Word document that exists within an Excel 2000 spreadsheet cell, Word opens as expected. When I'm done with Word and close it, I find that my Excel window has been minimized. I find this behavior to be quite annoying and am wondering if there's anything I can do to maintain my pre-click Excel window status. Thanks. Mark I'm not sure that this applied to xl2k, but I think with xl97, you could make a minor ...

command boxes from menu
I was working on word 2003, I had copied a portion of an online ebook to paste onto a new document, when I did right click to paste it on the doc. the command box appears outlined, no word commands, it's like a ghost. I then went to the menu at the top to Edit and find paste to do it from there and the same thing appeared; an outline of the command box, no word commands, it's like a ghost. I tried to pretend the words were there just not visible and moved my cursor to the position in which I thought paste was and clicked but nothing happened. Has anybody ever had this ...

command
still learning of the sql command HOW TO DISABLE XP_CMDSHELL AND DISABLE BOTH MAIL PROCEDURES ...

Document won't open on first page
When I open my saved document it opens on the second page and not the first/title page. This may have to do with the fact that the first pg. does not have its pg. # visible or that it's header differs from the rest of the document. How can I change this so that it opens to the first page? Thank you! A Word document always opens at the top of the file unless there is an AutoOpen macro forcing it to a different location. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Jerz" <Jerz@discussions.microsoft....

Can't select a word by double clicking it.
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel When I double-click a word, it won't select. Dragging over text will select it, and clicking in the margin selects a line, but I've lost the normal double-click to select a word. Confirm that you have Office & OS X fully updated before chasing any symptoms. Also, have you tried a simple restart of your Mac? Regards |:>) Bob Jones [MVP] Office:Mac On 4/7/10 8:39 PM, in article 59bb6a9e.-1@webcrossing.JaKIaxP2ac0, "John_Bonallack@officeformac.com" <John_Bonallack@officeformac...

remove button
How can I remove the Save and Close, or Save and New button on a phone call activity? Hi Troy, You could find out the location of the buttons via Javascript and then hide these buttons. Though this is relatively hard to do and unsupported, it can be done. Another approach, which in my opinion is a lot better, would be to remove the rights for users to create, delete and eventually update the entity phone call. You can do this in the security roles in the settings section. Hope this helps, -- Ronald Lemmen - MSCRM MVP Avanade Netherlands http://ronaldlemmen.blogspot.com/ "Troyz...

Adding a command to a picture
I have inserted a picture onto my form and in the Event / double click set up a macro to close the form however when i double click on my picture nothing is happening - help!! On Thu, 3 Jun 2010 06:02:22 -0700, casi <casi@discussions.microsoft.com> wrote: One suggestion would be to temporarily add a button to your form, and from the button wizard select the option to close the form. Then look behind the scenes what was generated, and implement your image_doubleclick the same way. -Tom. Microsoft Access MVP >I have inserted a picture onto my form and in the Event ...

Print First Page Only
Hi Groupies: In Outlook 2007, how can you tell it to print only the 1st page of a multi page email? Am I blind or is the option just not there? -- Thanks for taking the time! CJ --------------------------------------------------------- Know thyself, know thy limits....know thy newsgroups! "CJ" <private@newsgroups.com> wrote in message news:E83B3132-6092-4092-924C-47A651128836@microsoft.com... > Hi Groupies: > > In Outlook 2007, how can you tell it to print only the 1st page of a multi > page email? Am I blind or is the option just not there? > It is, b...

Command Handler
Hi Guys, I have a context menu and menu handler. I know how to acheive what is needed,but I am wanting to know if there is a better way to do this. When the user right clicks on a view, I get the OnRButtonDown(...), there I show the context menu. I have a command handler for the menuitems in the context menu also, clicking which will take me to the handler. What I want is to know is the point where the context menu popped up inside the command handler. Is there a way? Or Is caching the CPoint in OnRButtonDown and using it in the command handler the only way? Thanks Vipin &...

Make lines on a graph appear with a button
All, I need to create a graph with 40 or so lines graphed but only one up o the graph at a time with the use of buttons. I would really appreciat a hand, I am very new to this level of Excel. Thanks -- Message posted from http://www.ExcelForum.com Select all the data, and create a line chart Select a cell in the table Choose Data>Filter>AutoFilter From the dropdown list in one of the heading cells, select an item The chart will display the data for that item geistritter < wrote: > I need to create a graph with 40 or so lines graphed but only one up on > the graph at a tim...

Userform Command Button
In a Userform, I have multiple command buttons. For example: D1_Click D2_Click Depending on another event that occurs, I want to calculate in code the button name that I will be triggering the click event and then trigger the event. For example Application.Run "D" & i & "_Click" with i being the value of 1 or 2. Application.Run doesn't appear to work in the Userform. Thanks Steve Maybe it's because most subroutines in a userform module are "Private"??? Have you tried changing the "Private" prefix to "...

Dynamic Button Name?
Hi everone, Can a button name be made dynamic? For example, you create a button and want its name be read from cell A1. So if A1 read "Mike", the button name automatically become "Mike" and so on. Thanks, Mike for a button from the Forms toolbar, you can use this event macro. Put it in the worksheet code module (right-click the worksheet tab and choose View Code") Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Not Intersect(Target, Range("A1")) Is Nothing Then _ Me.Buttons(1).Caption = Range("A1").Value ...

Outlook address book alphabetizable by first OR LAST name
The address book should be easily alphabetizable by first or last name. Should be able to click to change from one view to the other. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/community/en-us/default.mspx?mid=4cbca018-f817-4472-...