quizzer
asked on
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_Cla imant_Last _Name.SetF ocus
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
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_Cla
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
Also, try setting the Focus to a specific control on the form:
Forms("Frm_Claimant!Txt_Cl aimant_Las t_Name")(" SomeContro lName").Se tFocus
mx
Forms("Frm_Claimant!Txt_Cl
mx
ASKER
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
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
ASKER
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
Go To Control, Set Focus Nothing Works when used in Access 2007
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
Try this syntax
Forms("Frm_Claimant")("Txt
btw ... where DOES the focus go ?
And better set back to Break On Unhandled Errors.
mx
ASKER
The focus goes nowhere that's the problem there is no focus set anywhere
ok ... did you try the syntax I posted ?
mx
mx
ASKER
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
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
ok ... are you *positive* that no code is running when this form opens ... such that the focus gets moved ?
mx
mx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
ASKER
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.Se tFocus
End With
DoCmd.OpenForm "Frm_Claimant", acNormal, "", "", , acNormal
DoCmd.GoToRecord acForm, "Frm_Claimant", acNewRec
With Form_Frm_Claimant
.Txt_Claimant_Last_Name.Se
End With
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
Compact & Repair first, then Zip to reduce size. Remove any sensitive data.
Kind of out of ideas ...
mx
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
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
btw ... I emulated your exact situation in A2003, same names etc., and the focus was set.
mx
mx
mx