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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetFocus from one subform to another subform

Status
Not open for further replies.

justme1310

Technical User
Jul 23, 2003
16
TT
Hi Everyone,

I'm working on developing a patient registration system which consists of 6 tables linked by a patient file number.
The data entry form has a main form and 5 subforms. I got no problems moving from the main form to the first subform (frmpaddr), but I'm having some difficulty in moving the focus from the field 'workphone' in one subform (frmpaddr) to the first address line (taddr1) in another subform(frmtaddr).

Can anyone help please?

If it will help, I can post the db (114kb).



Thanks

Will






 
What code are you using to set the focus?

I believe you will need to first set the focus on the main screen, then on the subform, then on the subform control.
 
Hi belovedcej,

Thanks for responding to my post.

This is the code that I have in the After_Update event of the last field of the first subform

Code:
  Private Sub PatWorkPh_AfterUpdate()
     Me.frmperson![frmtaddr].SetFocus
     Me.frmperson![frmtaddr].Form![Taddr1].SetFocus
  End Sub
All that is happening is the control keeps cycling thru all the fields of the first subform.

Any suggestions??

Thanks

Will
 
And what about this ?
Me.Parent.Form![frmtaddr].SetFocus
Me.Parent.Form![frmtaddr].Form![Taddr1].SetFocus

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PVS,

I tried your suggestion (below) but it didn't work
Code:
Me.Parent.Form![frmtaddr].SetFocus
Me.Parent.Form![frmtaddr].Form![Taddr1].SetFocus

However, I got the following to work

Code:
Forms!frmperson.frmtaddr.SetFocus
Forms!frmperson.frmtaddr.Taddr1.SetFocus

I think it has to do with the use of the Me keyword.
As I was going from one sub-form to another, not from the main form, I needed to fully qualify the control name.
(Courtesy Mattj Utter Access VIP).

Thanks so much for taking time to assist.

Appreciated

Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top