Set Focus Not Working in Access 2007 Opening Form go To New Record

I honestly cannot believe this
Simple Code on a Double Click of a Comb Box.  Used it for Years and Works fine in Access 2003

On Error Resume Next
    DoCmd.OpenForm "Frm_Claimant", acNormal, "", "", , acNormal
   
    DoCmd.GoToRecord acForm, "Frm_Claimant", acNewRec
    Forms!Frm_Claimant!Txt_Claimant_Last_Name.SetFocus
   

No matter what I do in Access 2007 it WILL NOT set focus on Txt_Claimant_Last_Name on the new record.

How can I fix this?  Thanks
quizzerAsked:
Who is Participating?
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.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Comment out the On Error Resume Next line and see what the Error is.

mx

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Also, try setting the Focus to a specific control on the form:

Forms("Frm_Claimant!Txt_Claimant_Last_Name")("SomeControlName").SetFocus

mx
0
quizzerAuthor Commented:
This is just Access 2007 opening a .mdb file.  All other functionality works perfectly

I remarked out the On Error Resume Next

Set the module options to break on all errors.  Ran it nothing happened no error and still no cursor in the Text Box Txt_Claimant_Last_Name


Txt_Claimant_Last_Name is a specific control on the form
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

quizzerAuthor Commented:
That is what is so weird No Error, Works Perfectly Fine in Access 2003, but no matter what I do

Go To Control, Set Focus Nothing Works when used in Access 2007
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
oops ... I missed the control name in my previous post - ignore that:

Try this syntax

Forms("Frm_Claimant")("Txt_Claimant_Last_Name").SetFocus

btw ... where DOES the focus go ?

And better set back to Break On Unhandled Errors.

mx
0
quizzerAuthor Commented:
The focus goes nowhere that's the problem there is no focus set anywhere
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
ok ... did you try the syntax I posted ?

mx
0
quizzerAuthor Commented:
Once again set it to break on all errors
used this Below
No Error and again no cursor in the Txt_Claimant_Last_Name with Access 2007
Works fine in Access 2003


    DoCmd.OpenForm "Frm_Claimant", acNormal, "", "", , acNormal
   
    DoCmd.GoToRecord acForm, "Frm_Claimant", acNewRec
   Forms("Frm_Claimant")("Txt_Claimant_Last_Name").SetFocus
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
ok ... are you *positive* that no code is running when this form opens ... such that the focus gets moved ?

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Meanwhile ... let try this:

    DoCmd.OpenForm "Frm_Claimant", acNormal, "", "", , acNormal
    DoCmd.GoToRecord acForm, "Frm_Claimant", acNewRec
    With Form_Frm_Claimant
        .Txt_Claimant_Last_Name.SetFocus
    End With
   
     'Forms("Frm_Claimant")("Txt_Claimant_Last_Name").SetFocus   ' Comment out

mx
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
quizzerAuthor Commented:
Yes this is a procedure we use all the time to double-click the combo box open a new form on a new record at a specific control.  For some reason Access 2007 is cauing issues.
0
quizzerAuthor Commented:
Tried this as well.  Same result no focus set


    DoCmd.OpenForm "Frm_Claimant", acNormal, "", "", , acNormal
    DoCmd.GoToRecord acForm, "Frm_Claimant", acNewRec
    With Form_Frm_Claimant
        .Txt_Claimant_Last_Name.SetFocus
    End With
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Well ... just for kicks, can you convert to A2003 and upload?
Compact & Repair first, then Zip to reduce size.  Remove any sensitive data.

Kind of out of ideas ...

mx
0
JVWCCommented:
MX
If it works in A03 as suggested I'll take a peek in A07. Let me know.

Quizzer, just a thought...
Have you tried setting the focus to another control to see if that works.Perhaps there is a reason that control cannot accept the focus.
Perhaps a msgbox as the last line will let you know if the code is actually running.
JC
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
btw ... I emulated your exact situation in A2003, same names etc., and the focus was set.

mx
0
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.