Cursor Positioning

  • Thread starter Thread starter Colin Hammond
  • Start date Start date
C

Colin Hammond

I have a lot of data to input using a form with a subforms. If all the
fields in the sub form did not need to be filled in for the last record the
cursor starts off in the wrong place when tabbing into the form; the
operator therefore has to use the mouse. I would like to use a button that
takes me to a new blank record with the records set so that I can tab
through without using the mouse and the cursor already to go in the first
field. Any tips?
 
Colin said:
I have a lot of data to input using a form with a subforms. If all the
fields in the sub form did not need to be filled in for the last record
the
cursor starts off in the wrong place when tabbing into the form; the
operator therefore has to use the mouse. I would like to use a button that
takes me to a new blank record with the records set so that I can tab
through without using the mouse and the cursor already to go in the first
field. Any tips?

I am not at all sure what you want.

First, are you having the problem with just the sub form or also with
the parent form?

Do you want the curser (focus) to move from field to field in the sub
form always starting in the same field and progressing in the same order, or
do you want it to start in different fields and-or progress in different
orders depending on the data in other fields of the sub form or the parent
form?

Does your question involve jumping from record to record in the sub
form?
 
Joseph Meehan said:
I am not at all sure what you want.

First, are you having the problem with just the sub form or also with
the parent form?

Do you want the curser (focus) to move from field to field in the sub
form always starting in the same field and progressing in the same order,
or do you want it to start in different fields and-or progress in
different orders depending on the data in other fields of the sub form or
the parent form?

Does your question involve jumping from record to record in the sub
form?


--
Joseph E. Meehan

26 + 6 = 1 It's Irish Math

I want to start with the focus in the first field of the main form and
progress through all the fields in the main form and progress to the first
field in the sub form and progress through those. The fields in my sub
form become less and less important so quite often the operator does not
tab to the end of the sub form. When he enters the next record the focus
in the sub form starts off in the wrong position. Also when I use a button
to make a new blank form available the focus on the new form is the
button.
 
Colin said:
I want to start with the focus in the first field of the main form and
progress through all the fields in the main form and progress to the first
field in the sub form and progress through those. The fields in my sub
form become less and less important so quite often the operator does not
tab to the end of the sub form. When he enters the next record the focus
in the sub form starts off in the wrong position. Also when I use a button
to make a new blank form available the focus on the new form is the
button.

Make you button and then in design mode, right click on the button and
select properties. Then the on click property. Add the code to go to the
filed you want the curser to be.

Navigate between controls, records, and form pages programmatically
You can automatically move to a control, record, or form page in response to
an event that happens on a form by carrying out the GoToControl, GoToRecord,
or GoToPage actions in a macro or an event procedure.

Use a macro

1.. To create a macro, click Macros under Objects, and then click the
New button on the Database window toolbar.
2.. Do one of the following:
a.. To move the focus to a specific control or field in the current
record, click GoToControl in the action list of a blank action row, and then
set the Control Name argument to the name of the control to which you want
to move.

a.. To make a specific record the current record, click GoToRecord in
the action list of a blank action row, and then set the arguments.

a.. To move the focus in the active form to the first control on a
specific form page, click GoToPage in the action list of a blank action row,
and then set the arguments.

3.. Click Save .
4.. To test, run the macro by clicking Run on the toolbar.
5.. Open the form in Design view.
6.. Open the property sheet for the form, select the event property that
you will use as a trigger and set it to the name of the macro.
For example, if a macro containing the GoToControl action is located in the
OnCurrent event for the form, moving from one record to another will move
the focus to the control.

Use Visual Basic code

1.. To open the event procedure for the appropriate event, open the form
in Design view.
2.. Display the property sheet for the form or control on the form and
then click the Event tab.
3.. Click the event property for the event that you want to trigger the
procedure.
For example, to respond to a mouse click on a command button, open the
button's OnClick event procedure.

4.. Click Build next to the property box to display the Choose Builder
dialog box.
5.. Double-click Code Builder to display the event procedure window.
6.. Do one of the following:
a.. To move the focus to a specific control or field in the current
record, carry out the GoToControl method in the procedure, setting the
Control Name argument to the name of the control to which you want to move.
b.. To make a specific record the current record or to create a new
record, use the GoToRecord method to carry out the GoToRecord action in the
procedure.
c.. To move the focus in the active form to the first control on a
specific form page, use the GoToPage method to carry out the GoToPage action
in the procedure.

7.. To test, run the procedure by opening the form in Form view and
performing the event that triggers the move.
For example, if the procedure is located in the event procedure for a
command button, click the command button to observe the focus move to the
control, record, or form page.

Tip

You can also use Microsoft Visual Basic for Applications to locate or move
between records by using a Recordset object and the Seek method or any of
the Move or Find methods.
 

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

Back
Top