Go to a control in a new record

L

Lasse T

Hi again.

Private Sub Form_Unload(Cancel As Integer)
Forms![registreringorder]![UformOrder].SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub

This code adds a new record, but i also want focus on the control
"artikelnr" in that new record. It is a continous form and the focus are in
"artikelnr" on the first record of the form.

Thanks in advance

Lasse T
--------------
 
S

Sandra Daigle

Just add the following line after the docmd.GotoRecord

Forms!registreringorder.artikelnr.setfocus

If this doesn't work I would suspect that you have code running in the open
or current event of the form that is interfering.
 
L

Lasse T

I have tried this but the focus is set on the artikelnr control in the first
record of the form, not in the new empty record. I did a workaround and
solved the problem in a whole different way.

I have had a couple of extremely fun days struggeling with my Access
project. It´s really fun bit it takes up all too much time. I´ts impossible
to let go once I have started. I think I´m beginning to see the end of it
now. Everything works exept for a few minor problems. I´m going to post one
more question and hope it is the last one, but then again, anything can
happend.

Thank you all for helping me over the highest hills.

Lasse T
-------------

Sandra Daigle said:
Just add the following line after the docmd.GotoRecord

Forms!registreringorder.artikelnr.setfocus

If this doesn't work I would suspect that you have code running in the open
or current event of the form that is interfering.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Lasse said:
Hi again.

Private Sub Form_Unload(Cancel As Integer)
Forms![registreringorder]![UformOrder].SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub

This code adds a new record, but i also want focus on the control
"artikelnr" in that new record. It is a continous form and the focus
are in "artikelnr" on the first record of the form.

Thanks in advance

Lasse T
--------------
 

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


Top