If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Referencing a subform
Hi
I have a form "frmNotice" & a subform "YoungPersonSubform" with a combo box to update the record displayed in the subform The two forms are linked on the field IDPerson The challenge I have is Refreshing or Requerying the subform with the error 2465 "can't find the field YoungPersonSubform" the code for the combo box is: Private Sub Combo60_AfterUpdate() ' Find the record that matches the control. Forms!frmNotice.IDPerson = Combo60 'updating the mainform - works Forms!frmNotice!YoungPersonSubform.Form.Requery '2465 error cant find field.. Forms![YoungPersonSubform].Requery '2450 cant finnd the form ... Forms!frmnotice![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.form![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.Form![YoungPersonSubform].Form.Requery '2465 " " " I have also tried: DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 With error 2489 The object 'YoungPersonSubform' isn't open! Office 2003 being used, I can see the subform open within a tab on the parent form, so why am I having these problems? I have listed just some of the variations I have tried to refresh the subform, others have been tried with similar effect with & without brackets for the formname. The subform will update if I move to another record & return to the first!! I have also tried the refresh line of code in the onCurrent event on the mainForm with no results. Would be most grateful for some assisatance - Thanks -- Richard |
#2
|
|||
|
|||
Referencing a subform
Depending on how YoungPersonSubform was added as a subform, the name of the
subform control on frmNotice may be something different. Also, where is Combo60: on frmNotice, or on YoungPersonSubform? -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele (no e-mails, please!) "Richard" wrote in message ... Hi I have a form "frmNotice" & a subform "YoungPersonSubform" with a combo box to update the record displayed in the subform The two forms are linked on the field IDPerson The challenge I have is Refreshing or Requerying the subform with the error 2465 "can't find the field YoungPersonSubform" the code for the combo box is: Private Sub Combo60_AfterUpdate() ' Find the record that matches the control. Forms!frmNotice.IDPerson = Combo60 'updating the mainform - works Forms!frmNotice!YoungPersonSubform.Form.Requery '2465 error cant find field.. Forms![YoungPersonSubform].Requery '2450 cant finnd the form ... Forms!frmnotice![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.form![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.Form![YoungPersonSubform].Form.Requery '2465 " " " I have also tried: DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 With error 2489 The object 'YoungPersonSubform' isn't open! Office 2003 being used, I can see the subform open within a tab on the parent form, so why am I having these problems? I have listed just some of the variations I have tried to refresh the subform, others have been tried with similar effect with & without brackets for the formname. The subform will update if I move to another record & return to the first!! I have also tried the refresh line of code in the onCurrent event on the mainForm with no results. Would be most grateful for some assisatance - Thanks -- Richard |
#3
|
|||
|
|||
Referencing a subform
Hi Douglas
Thanks for reply. Combo60 is on subform On the mainform is a Tab control on which the subforms are placed, the name of this tab is 'Page104'. Name of the subform seems to be consistent, in the visual Basic Window displayed as Form_YoungPersonSubform, as is its parent Form_frmNotice. Since found a discrepancy in the naming of the subform & rectified, Error messages have disappeared, but Subform data still does not match Mainform following the use of the combo to choose another record, so my understanding is that it is not refreshed. Use of the Menu, Records -- Refresh has no effect either. The:- DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 Again reports the subform is not open, when I can see it is! Moving to another record on mainform & returning or closing & re-opening the mainform does then show the correct result. I still need to get the subform to refresh or requery Many thanks for your advice -- Richard "Douglas J. Steele" wrote: Depending on how YoungPersonSubform was added as a subform, the name of the subform control on frmNotice may be something different. Also, where is Combo60: on frmNotice, or on YoungPersonSubform? -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele (no e-mails, please!) "Richard" wrote in message ... Hi I have a form "frmNotice" & a subform "YoungPersonSubform" with a combo box to update the record displayed in the subform The two forms are linked on the field IDPerson The challenge I have is Refreshing or Requerying the subform with the error 2465 "can't find the field YoungPersonSubform" the code for the combo box is: Private Sub Combo60_AfterUpdate() ' Find the record that matches the control. Forms!frmNotice.IDPerson = Combo60 'updating the mainform - works Forms!frmNotice!YoungPersonSubform.Form.Requery '2465 error cant find field.. Forms![YoungPersonSubform].Requery '2450 cant finnd the form ... Forms!frmnotice![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.form![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.Form![YoungPersonSubform].Form.Requery '2465 " " " I have also tried: DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 With error 2489 The object 'YoungPersonSubform' isn't open! Office 2003 being used, I can see the subform open within a tab on the parent form, so why am I having these problems? I have listed just some of the variations I have tried to refresh the subform, others have been tried with similar effect with & without brackets for the formname. The subform will update if I move to another record & return to the first!! I have also tried the refresh line of code in the onCurrent event on the mainForm with no results. Would be most grateful for some assisatance - Thanks -- Richard . |
#4
|
|||
|
|||
Referencing a subform
Forms being used as subforms aren't open in the traditional sense in that
they're not added to the Forms collection (which represents all open forms in the database). The only way you can interact with them is via the subform control on the parent form. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Richard" wrote in message ... Hi Douglas Thanks for reply. Combo60 is on subform On the mainform is a Tab control on which the subforms are placed, the name of this tab is 'Page104'. Name of the subform seems to be consistent, in the visual Basic Window displayed as Form_YoungPersonSubform, as is its parent Form_frmNotice. Since found a discrepancy in the naming of the subform & rectified, Error messages have disappeared, but Subform data still does not match Mainform following the use of the combo to choose another record, so my understanding is that it is not refreshed. Use of the Menu, Records -- Refresh has no effect either. The:- DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 Again reports the subform is not open, when I can see it is! Moving to another record on mainform & returning or closing & re-opening the mainform does then show the correct result. I still need to get the subform to refresh or requery Many thanks for your advice -- Richard "Douglas J. Steele" wrote: Depending on how YoungPersonSubform was added as a subform, the name of the subform control on frmNotice may be something different. Also, where is Combo60: on frmNotice, or on YoungPersonSubform? -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele (no e-mails, please!) "Richard" wrote in message ... Hi I have a form "frmNotice" & a subform "YoungPersonSubform" with a combo box to update the record displayed in the subform The two forms are linked on the field IDPerson The challenge I have is Refreshing or Requerying the subform with the error 2465 "can't find the field YoungPersonSubform" the code for the combo box is: Private Sub Combo60_AfterUpdate() ' Find the record that matches the control. Forms!frmNotice.IDPerson = Combo60 'updating the mainform - works Forms!frmNotice!YoungPersonSubform.Form.Requery '2465 error cant find field.. Forms![YoungPersonSubform].Requery '2450 cant finnd the form ... Forms!frmnotice![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.form![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.Form![YoungPersonSubform].Form.Requery '2465 " " " I have also tried: DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 With error 2489 The object 'YoungPersonSubform' isn't open! Office 2003 being used, I can see the subform open within a tab on the parent form, so why am I having these problems? I have listed just some of the variations I have tried to refresh the subform, others have been tried with similar effect with & without brackets for the formname. The subform will update if I move to another record & return to the first!! I have also tried the refresh line of code in the onCurrent event on the mainForm with no results. Would be most grateful for some assisatance - Thanks -- Richard . |
#5
|
|||
|
|||
Referencing a subform
Hi Douglas
Thanks for your help, I have finally cracked the problem by requerying the Parent form. The subform then matched the Parent. Keep up the good work! -- Richard "Douglas J. Steele" wrote: Forms being used as subforms aren't open in the traditional sense in that they're not added to the Forms collection (which represents all open forms in the database). The only way you can interact with them is via the subform control on the parent form. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Richard" wrote in message ... Hi Douglas Thanks for reply. Combo60 is on subform On the mainform is a Tab control on which the subforms are placed, the name of this tab is 'Page104'. Name of the subform seems to be consistent, in the visual Basic Window displayed as Form_YoungPersonSubform, as is its parent Form_frmNotice. Since found a discrepancy in the naming of the subform & rectified, Error messages have disappeared, but Subform data still does not match Mainform following the use of the combo to choose another record, so my understanding is that it is not refreshed. Use of the Menu, Records -- Refresh has no effect either. The:- DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 Again reports the subform is not open, when I can see it is! Moving to another record on mainform & returning or closing & re-opening the mainform does then show the correct result. I still need to get the subform to refresh or requery Many thanks for your advice -- Richard "Douglas J. Steele" wrote: Depending on how YoungPersonSubform was added as a subform, the name of the subform control on frmNotice may be something different. Also, where is Combo60: on frmNotice, or on YoungPersonSubform? -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele (no e-mails, please!) "Richard" wrote in message ... Hi I have a form "frmNotice" & a subform "YoungPersonSubform" with a combo box to update the record displayed in the subform The two forms are linked on the field IDPerson The challenge I have is Refreshing or Requerying the subform with the error 2465 "can't find the field YoungPersonSubform" the code for the combo box is: Private Sub Combo60_AfterUpdate() ' Find the record that matches the control. Forms!frmNotice.IDPerson = Combo60 'updating the mainform - works Forms!frmNotice!YoungPersonSubform.Form.Requery '2465 error cant find field.. Forms![YoungPersonSubform].Requery '2450 cant finnd the form ... Forms!frmnotice![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.form![YoungPersonSubform].Requery '2465 cant find field ... Forms!frmnotice.Form![YoungPersonSubform].Form.Requery '2465 " " " I have also tried: DoCmd.GoToRecord acDataForm, "youngpersonsubform", acGoTo, IDPerson = Combo60 With error 2489 The object 'YoungPersonSubform' isn't open! Office 2003 being used, I can see the subform open within a tab on the parent form, so why am I having these problems? I have listed just some of the variations I have tried to refresh the subform, others have been tried with similar effect with & without brackets for the formname. The subform will update if I move to another record & return to the first!! I have also tried the refresh line of code in the onCurrent event on the mainForm with no results. Would be most grateful for some assisatance - Thanks -- Richard . . |
Thread Tools | |
Display Modes | |
|
|