Differenc between Lost Focus and On Exit

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,
 
B

Beetle

Use the forms Current event instead.

Private Sub Form_Current

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

End Sub
 
J

Jacqueline

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,
 
B

Beetle

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cancel On Lost Focus Event 3
Keep Cursor in Subform 4
lost focus 6
Lost Focus Woes 7
Lost My Focus 3
Oversensitive touchpad on modern laptops 0
set focus on combo box 1
List Box 1

Top