Position cursor on subform

  • Thread starter Thread starter Tom Hart
  • Start date Start date
T

Tom Hart

I am trying to place the cursor at the Case Disposition
field when I detect an error by the user. I am using the
GoToControl action below within a macro, but it's not
working.

[Forms]![frmModifyCase]![frmCaseDisp].[Form]![Case
Disposition]

Do I need to set the focus to the subform first? and how
do I do this within a macro?

Thanks
 
When you want to go from the main form to a control on a subform, you must set
the focus to the subform control first and then set the focus to the control on
the subform:

Me!NameOfSubformControl.SetFocus
Me!NameOfSubformControl.Form!NameOfFieldOnSubform.SetFocus
 
Please help with with how to set the focus to the control
by using a macro. I am using the SetValue action and it
does not seem to be working.

Thanks
-----Original Message-----
When you want to go from the main form to a control on a subform, you must set
the focus to the subform control first and then set the focus to the control on
the subform:

Me!NameOfSubformControl.SetFocus
Me!NameOfSubformControl.Form!NameOfFieldOnSubform.SetFocus

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


I am trying to place the cursor at the Case Disposition
field when I detect an error by the user. I am using the
GoToControl action below within a macro, but it's not
working.

[Forms]![frmModifyCase]![frmCaseDisp].[Form]![Case
Disposition]

Do I need to set the focus to the subform first? and how
do I do this within a macro?

Thanks


.
 
Do it with code!

1. Create a button on your form in design view.
2. Select the button and click on the properties button on the toolbar at the
top of the screen. Click on the Events tab.
3. You will see the Click event in the list. Click in the white area of the
Click event.
4. Two buttons will appear at the far right. Click on the button with the three
dots.
5. A new dialog will appear. Click on Code Builder to select it and click OK.
You will now be at the form's code module.
6. You will see two lines of code at the cursor position that look like:
Private Sub XXXX_Click()

End Sub
where XXXX is the name you gave to the button.
7. Type the code I previously gave you between the two lines.
8. Close everything.

When you click on the button you will now get the results you want.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



Tom Hart said:
Please help with with how to set the focus to the control
by using a macro. I am using the SetValue action and it
does not seem to be working.

Thanks
-----Original Message-----
When you want to go from the main form to a control on a subform, you must set
the focus to the subform control first and then set the focus to the control on
the subform:

Me!NameOfSubformControl.SetFocus
Me!NameOfSubformControl.Form!NameOfFieldOnSubform.SetFocus

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


I am trying to place the cursor at the Case Disposition
field when I detect an error by the user. I am using the
GoToControl action below within a macro, but it's not
working.

[Forms]![frmModifyCase]![frmCaseDisp].[Form]![Case
Disposition]

Do I need to set the focus to the subform first? and how
do I do this within a macro?

Thanks


.
 
Back
Top