Differenc between Lost Focus and On Exit

  • Thread starter Thread starter Jacqueline
  • Start date Start date
J

Jacqueline

Can someone explain the difference between these two events for me please? I
want to creat an event to move the cursor to the first input box on the form
when the user clicks the New Record button.

Thank you,
 
Use the forms Current event instead.

Private Sub Form_Current

If Me.NewRecord Then Me![SomeControl].SetFocus

End Sub
 
Sean,
I am not the strongest VB user but have ventured into some simple stuff.
However, now that I am in Access 2007 when ever I open the code option box
all I see is the start and stop of the sub routine, no code between.

I have been afraid to mess around with it for fear of messing something up.
I have also made sure my databases are in a "Trusted Folder". Have you run
into this or am I just not hold my mouth right??
Thanks much,
--
Jacqueline


Beetle said:
Use the forms Current event instead.

Private Sub Form_Current

If Me.NewRecord Then Me![SomeControl].SetFocus

End Sub
--
_________

Sean Bailey


Jacqueline said:
Can someone explain the difference between these two events for me please? I
want to creat an event to move the cursor to the first input box on the form
when the user clicks the New Record button.

Thank you,
 
when ever I open the code option box all I see is the start and stop of
the sub routine, no code between.

That's all you should see unless you have previously put some code in that
event. In other words, if you open the properties sheet for your form, go
to the Event tab, click the build (...) button to the right of the On Current
event and select Code Builder, the code window should open displaying
the following lines;

Private Sub Form_Current ( )

End Sub

All you would need to do is put;

If Me.NewRecord Then Me![SomeControl].SetFocus

in between those lines, using your actual control name in place of
[SomeControl]. If your db is in a trusted location, then the code should
work. If you're worried about making a mistake, just make a backup
copy of your db before you make any changes (which you should always
do anyway).
--
_________

Sean Bailey


Jacqueline said:
Sean,
I am not the strongest VB user but have ventured into some simple stuff.
However, now that I am in Access 2007 when ever I open the code option box
all I see is the start and stop of the sub routine, no code between.

I have been afraid to mess around with it for fear of messing something up.
I have also made sure my databases are in a "Trusted Folder". Have you run
into this or am I just not hold my mouth right??
Thanks much,
--
Jacqueline


Beetle said:
Use the forms Current event instead.

Private Sub Form_Current

If Me.NewRecord Then Me![SomeControl].SetFocus

End Sub
--
_________

Sean Bailey


Jacqueline said:
Can someone explain the difference between these two events for me please? I
want to creat an event to move the cursor to the first input box on the form
when the user clicks the New Record button.

Thank you,
 
Back
Top