Move cursor to field in subform from main form


T

tbrogdon

Is there a general way to not only SetFocus to a specific field in a
subform (datasheet view) but also move the cursor from the last combo
box on the main form to the first field in the subform so once the
selection is made in the last combo box on the main form, the user
hits the <enter> key and the cursor moves to the first empty field in
the subform in datasheet view?

Thanks,

Tim
 
Ad

Advertisements

M

Marshall Barton

Is there a general way to not only SetFocus to a specific field in a
subform (datasheet view) but also move the cursor from the last combo
box on the main form to the first field in the subform so once the
selection is made in the last combo box on the main form, the user
hits the <enter> key and the cursor moves to the first empty field in
the subform in datasheet view?


If Me.Dirty Then Me.Dirty = False 'save any main changes
Me.subformcontrol.SetFocus
Me.subformcontrol.Form.firsttextbox.SetFocus

The above logic can be used in many places ibckuding the
AfterUpdate event of you last combo box.
 
T

tbrogdon

If Me.Dirty Then Me.Dirty = False       'save any main changes
Me.subformcontrol.SetFocus
Me.subformcontrol.Form.firsttextbox.SetFocus

Beautiful! Thank you!

For my own knowledge, what is the logic bhind .Dirty? It appears to be
very handy. Do you have a suggestion as to where I can learn more
about its applicability?

Thank you again,

Tim
 
M

Marshall Barton

For my own knowledge, what is the logic bhind .Dirty? It appears to be
very handy. Do you have a suggestion as to where I can learn more
about its applicability?


The Dirty property of a form indicates whether the current
record has been modified or not. If it has, then setting
the property to False requires the modified record to be
saved back to its table.

The first place to look for more information about a
property, method, statement, etc. is in VBA Help.
Unfortunately, the Dirty help topic barely mentions that the
property is read/write. so using it to save a record is
mostly inferred as a logical consequence of its meaning.
 
T

tbrogdon

Unfortunately, the Dirty help topic barely mentions that the
property is read/write. so using it to save a record is
mostly inferred as a logical consequence of its meaning.


Thank you for the info Marshall. I am pretty sure that the majority of
my repeated questions on this forum are related to the volume of
inference needed to actually accomplish a task via the Help index and
even most books.

Could you also refer me to a good book reference for general "task
driven" info - a "How To" that is a bit beyond the basic "This is the
most fundamental or only slightly advanced" book?

Thanks again,

Tim
 
Ad

Advertisements

M

Marshall Barton

Could you also refer me to a good book reference for general "task
driven" info - a "How To" that is a bit beyond the basic "This is the
most fundamental or only slightly advanced" book?


I'm probably not a good judge of books at that level.

Personally, I think a couple of excellent books are:
Access 2003 Inside Out by John Viescas
Access XXXX Developer's Handbook by Ken Getz, et al

However, you should try to review a copy before buying to
see how they do or do not relate to your idea of what is
helpful.
 
Ad

Advertisements


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

Top