Have to Hit Exit Command Button Twice to Exit Form in Access

i have a button on my form that uses a macro to close it

when i click the button the focus goes to txtMake textbox. then i have to click again to actually exit form

code is below from form.
Option Compare Database
 
Private Sub cmdDetails_Click()
    DoCmd.OpenForm "details", , , , , acDialog, OpenArgs:=Me.txtBAM
End Sub
 
Private Sub cmdExit_Click()
    DoCmd.OpenForm "Switchboard"
    DoCmd.Close acForm, "entermachine"
End Sub
 
Private Sub Command43_Click()
    DoCmd.PrintOut acSelection
End Sub
 
Private Sub Command74_Click()
    DoCmd.Close acForm, "entermachine"
    DoCmd.OpenForm "switchboard"
End Sub
 
Private Sub cmdViewPics_Click()
    DoCmd.OpenForm "picture import", acNormal, , , , acDialog
End Sub
 
Private Sub txtSellPrice_Exit(Cancel As Integer)
    txtSellPrice = Format(txtSellPrice, "$#,00.00")
End Sub
 
Private Sub txtSellPrice2_Exit(Cancel As Integer)
    txtSellPrice2 = Format(txtSellPrice2, "$#,00.00")
End Sub
 
Private Sub txtType_Exit(Cancel As Integer)
    If txtType.Text = "Grain Head" Then
        Me.txtFuel.SetFocus
        Me.txtFuel.Text = "N/A"
        Me.txtEngine.SetFocus
        Me.txtEngine.Text = "N/A"
        Me.txtEngineSerial.SetFocus
        Me.txtEngineSerial.Text = "N/A"
        Me.txtFTires.SetFocus
        Me.txtFTires.Text = "N/A"
        Me.txtRTires.SetFocus
        Me.txtRTires.Text = "N/A"
        Me.txtDuals.SetFocus
        Me.txtDuals.Text = "N/A"
        Me.txt4WD.SetFocus
        Me.txt4WD.Text = "N/A"
        Me.txtTrans.SetFocus
        Me.txtTrans.Text = "N/A"
        Me.txtHours.SetFocus
        Me.txtHours.Text = "N/A"
        Me.txtMake.SetFocus
    End If
        Me.txtType.SetFocus
    If txtType.Text = "Corn Head" Then
        Me.txtFuel.SetFocus
        Me.txtFuel.Text = "N/A"
        Me.txtEngine.SetFocus
        Me.txtEngine.Text = "N/A"
        Me.txtEngineSerial.SetFocus
        Me.txtEngineSerial.Text = "N/A"
        Me.txtFTires.SetFocus
        Me.txtFTires.Text = "N/A"
        Me.txtRTires.SetFocus
        Me.txtRTires.Text = "N/A"
        Me.txtDuals.SetFocus
        Me.txtDuals.Text = "N/A"
        Me.txt4WD.SetFocus
        Me.txt4WD.Text = "N/A"
        Me.txtTrans.SetFocus
        Me.txtTrans.Text = "N/A"
        Me.txtHours.SetFocus
        Me.txtHours.Text = "N/A"
        Me.txtMake.SetFocus
    End If
        Me.txtMake.SetFocus
End Sub

Open in new window

LVL 2
Samuel BakerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

puppydogbuddyCommented:
Try commenting out line 75, which will let your code flow through to line 77.  Otherwise, anytime your code executes line 75, it will also execute line 77.....thus setting focus twice.
0
Samuel BakerAuthor Commented:
i just deleted the whold thing and inserted a button to do what i needed it to do
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.