Referencing parent form on Requery - Error 2450

pcotcamp

New member
Local time
Today, 00:57
Joined
Apr 4, 2014
Messages
2
All,

I am new to Access and VBA, having decided to take the plunge after years of programming in Visual dBase and more recently dBase 8 Plus. So far I am loving the switch and things are progressing well.

PROBLEM: I have seen numerous posts about requerying forms/sub-forms that are similar to my problem, but none that seem to fit it exactly. Apparently it is often a source of confusion and I hope someone here can offer a simple solution. I am sure it is simple problem, but I have been stuck for a while now.

In short, here is what I am trying to accomplish:

1. I have a two-tier, tabbed Navigation form (Menu-Main).
2. One of the second-tier tabs opens a form (VendorMain) which displays a Datasheet based on [Query.Vendor_Query]
3. VendorMain contains a Command Button (EditButton), which calls a subform (VendorForm) used for editing.
4. Upon saving the edits, VendorForm's OnClose event is supposed to Requery the datasheet on VendorMain, so the edits are reflected when the user returns.

I have tried over a dozen different permutations of the following, but nothing seems to work:

Me!Parent.Requery
Forms!VendorMain.Requery
Forms![Vendor_Query].Requery
Forms!Main-Menu!VendorMain.Requery
Etc...

VendorForm opens, edits, saves and closes perfectly. However, I consistently get the following error and the parent form is not requeried:
Runtime Error 2450 - Cannot find the referenced form VendorMain

Code available upon request.

Any help would be greatly appreciated.

-Paige :banghead:
 
...
2. One of the second-tier tabs opens a form (VendorMain) which displays a Datasheet based on [Query.Vendor_Query]

3. VendorMain contains a Command Button (EditButton), which calls a subform (VendorForm) used for editing.

When you say open in section 2 and 3 - do you mean the form(s) is on a tab (like a sub form) or does it open as a "stand alone" form(s)?
If a form open as "stand alone" it hasn't any parent, even though it is opened by a button of another form.

If I've have problem to find the right "path" to controls on forms I use the Expression Builder in the query, see attached picture.

  • Open then form in ”Form View”
  • Create a new query.
  • Place the cursor in the ”Criteria” column
  • Click on the wizard.
  • Find your open form in the list.
  • Find the control in the form.
  • Click the <Value>, then the ”path” to the control is shown.
attachment.php
 

Attachments

  • Expression builder.jpg
    Expression builder.jpg
    83.2 KB · Views: 660
Thanks for the tip. I should have thought of that. It easily helps identify the correct path.

Unfortunately, still no joy. I have been stuck on this for three days now and it is driving me nuts.

I have tried every possible permutation of form names, NavigationSubform names, bangs, dots, OnClose, OnCurrent, AfterUpdate, events etc. and it still will not work.

To summarize once again, the hierarchy I am working with is as follows:

1. Main Menu form: Menu-Main
2. SubForm1: NavigationSubform1 (tabbed Navigation Form)
3. Subform2: NavigationSubform2 (tabbed Navigation Form - Contains VendorMain on tab #3)
4. Form: VendorMain - Form containing a Datasheet based on [Vendors Query] with Add /Edit Command Buttons
4. Form: VendorForm (Editing form called by VendorMain's Command Buttons)

**NOTE: I am using overlapping forms and VendorForm is opened as a "standalone" form and not within a subform. VendorForm uses its own query and is not linked to the query of VendorMain. (<--Is this the source of my problem?)

To be clear:

Subform1 is tabbed and contains a second tier of Navigation Tabs. Tab #3 is "Operations"

SubForm2 is also tabbed. Tab #2, "Vendors" contains a link to a form called VendorMain.

VendorMain contains a Command Button called EditButton.

EditButton passes the correct record identifier and opens an editing form: VendorForm.

Upon saving my edits in VendorForm, all I am trying to accomplish is an requery of the Datasheet in Vendormain so that the edits are reflected.

I have tried placing the Requery command in both VendorMain and VendorForm, in every possible Event. All have failed.

The obvious(?) choice would be to place the following in the "Save" button's OnClick event in VendorForm: Forms!Menu-Main!NavigationSubform1!NavigationSubform2.Form.Requery

However, doing so results in an error: "There is no field named Forms!Menu-Main!NavigationSubform1!NavigationSubform2 in the current record."

Can anyone offer a solution? I am at a complete dead-end here. :banghead:

-Paige
 
Can anyone offer a solution? I am at a complete dead-end here. :banghead:
-Paige
Is it possible for you to post a (stripped) version of you database with some sample data, (zip it)?
 

Users who are viewing this thread

Back
Top Bottom