Set focus for new record

When my form opens for a new record I'm trying to set focus on a particular textbox.  Here's my code which isn't working...

Private Sub Form_Open(Cancel As Integer)

    If Me.NewRecord = True Then
        Me.txtEstDate.SetFocus
        Else
        Me.cmdCloseForm.SetFocus
    End If

End Sub

Thoughts?

--Steve
SteveL13Asked:
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.

AccessGuy1763Commented:
I think this is simply a timing issue.  You don't mention an error message and I just did a little test and found that there is no error message when you run code like yours... it just doesn't work.  I believe it's because those fields aren't actually available yet, but it's hard to be sure.

What I do know is that type of scenario works fine for me in the _Load event.  I think the end result should be the same so try it out and let us know how it goes.
0
Gustav BrockCIOCommented:
Move it to the OnCurrent event.

/gustav
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
Dale FyeCommented:
No points.  Agree with gustav.  Generally, if you want to work with a particular record, you should use the Current event.
0
AccessGuy1763Commented:
I just suggested _Load because the first four words in the post are "When my form opens".

If he is using the form in a scenario where he's moving between records and potentially getting to a new record that way, then I totally agree that the Current event is more appropriate.
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.