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

subforms of subforms!!!! ARRRGGHH

Status
Not open for further replies.

jgoodman00

Programmer
Jan 23, 2001
1,510
Ok, I have a form named frmPhotoViewer. This has a subform embedded in it called Subform_Loader. The user selects a record from a combo-box which contains a numerical code. This numerical code dictates which form opens in Subform_Loader (e.g. frmFence). Now, within the forms which load in Subform_Loader are another series of subforms.

This currently runs fine, but I need the user to be able to tab from one of the subforms (e.g. subform_remarks) to another subform (e.g. subform_location).

I have the following code in the 'on lost focus' event of the last control in SubformRemarks:

DoCmd.GotoControl "SubformLocation"

This works perfectly when frmFence is run on its own. So thinking that I simply needed to reference the subform in carefully when it was running through the frmPhotoViewer I changed the code into the following in the 'on lost focus' event'.


If frmPhotoViewerOpen = True Then
DoCmd.GotoControl "Forms!frmPhotoViewer!Subform_Loader!SubformLocation"
Else
DoCmd.GotoControl "SubformLocation"
End If

This works fine if frmFence is run on its own, but if it is run as a subform in frmPhotoViewer it does not work.

Does anyone know how I can reference this in to make it work???



Thanks
James Goodman
j.goodman00@btinternet.com
 
I suggest you look into the parent property just as me makes refering to forms easier I think you will find parent will make things better as well.
Good luck
 
to answer my own question, here is the solution:

to goto the control, it can be referenced as follows:

Forms!frmPhotoViewer!Subform_Loader!Subform_Length.SetFocus

Simple really!!! James Goodman
j.goodman00@btinternet.com
 
Good job and thanks for posting the solution here for all... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top