Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating To A Control in a subform

Status
Not open for further replies.

CharlieT302

Instructor
Mar 17, 2005
406
US
Hi Folks,

I have a main form called "main." It has a subform called Subform1. Subform1 has a subform called Subform2.

Main
Subform1
Subform2

While in Subform1, I have a button that is supposed to go to a field called "Remote" on subform2 when there is an error.

Here is what I have done. The focus never actually goes to the field.

If Err = 3200 Then
Me![Subform2].Form![Remote].SetFocus

Any Ideas?
 
And this ?
If Err = 3200 Then
Me![Subform2].SetFocus
Me![Subform2].Form![Remote].SetFocus
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Well that was just too simple. Thank you, I really appreciate it.
 
One more problem,

I am using the code you and I discussed to select related records for deletion. Once the focus is obtained in the subform, the record is deleted. This works fine. However, if the user cancels the delete action, it generates a runtime error 2501; a second error message. I would like to simply cancel this message.

The problem is that the code from the above message is already using the "On Error" command. How can I tell the program to ignore the second error? Below is the actual code I am using.

On Error GoTo Error_Delete

DeleteRecord:
DoCmd.RunCommand acCmdDeleteRecord

Error_Delete:
If (Err = 3200) Then
Me![frm Provider Provisions].SetFocus
Me![frm Provider Provisions].Form![RemoteM].SetFocus
DoCmd.RunCommand acCmdDeleteRecord
Response = acDataErrContinue
End If


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top