Open continuous subform to set focus on new record

Access 2010

Hello,
I need to code a continuous subform (frmProductionTracking) to set focus on a new record when the main form (frmJob) is opened.  I've tried some of solutions already posted but nothing seems to work for me.  BTW the control name for the subform frmProductionTracking is ctrProductionTracking.

Thanks for any help.


jnewmanAsked:
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.

mbizupCommented:
Try this from the open event of the main form:


Me.ctrProductionTracking.SetFocus
DoCmd.RunCommand acCmdRecordsGoToNew

Open in new window

0
jnewmanAuthor Commented:
No it didn't work.  What I'll do is update the database to look at.  There is just garbage test data in it anyway.
JSTS.accdb
0
mbizupCommented:
<No it didn't work.>

Can you clarify?

When I open frmJob (double-clicking on it in the Navigation Pane), the focus is immediately set on a new record in the production tracking subform, with the cursor in the Machine Name combo.

If this is not what you are looking for, please clarify where it is going wrong


frmJob.png
0
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

jnewmanAuthor Commented:
That's odd because it doesnt happen for me. Could I be missing some DAO or other VBA plug in?
0
mbizupCommented:
Nothing like that's needed, and we are both running Access 2010.

Try adding a message box to the code just for debugging,  simply to ensure that the code is actually running.
0
mbizupCommented:
Also, if this is a scaled down sample, does your real database contain any code that may be interfering with the open event?

Also, try this code in the main form's current event.

Did you double click on the form to open it or just switch from design view to form view (which may skip certain events )?
0
jnewmanAuthor Commented:
The sample I supplied is the  real database.  I did close and open the db.  As soon as I can I'll try the message box.
0
mbizupCommented:
Last thought here before calling it a night.  Since this is Access 2010, make sure that you have enabled macros /vba.

I'll check back in the morning.
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
jnewmanAuthor Commented:
Enabling the macro /vba in the trust settings did the trick.  Thanks for the code and advice.
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.