Full Version: Calling Command In Navigation Form Subform
UtterAccess Forums > Microsoft® Access > Access Forms
PaulWood
I am new to Access' "Navigation Form" paradigm and am trying to execute a command button on a Navigation Form subform and can't figure out the right syntax. Here's some info that might help sort things out:

Navigation Form name: "Navigation form"
Navigation Form subform container: "SubformContainer"
Navigation Subforms:
  • SubForm1
  • SubForm2
  • SubForm3

Navigation Form Buttons:
  • NavBtnSubForm1 --> SubForm1
  • NavBtnSubForm2 --> SubForm2
  • NavBtnSubForm3 --> SubForm3

Here's the scenario:
I opened the Navigation Form and clicked on NavSubForm2 button which opened SubForm2.
Now, I need to open SubForm3 in a special way. There is a command button in SubForm2 that executes some preliminary code then opens SubForm3. That works OK when I click on the command button in SubForm2. HOWEVER, I want the user to be able to click NavSubForm3 button which, in turn, will execute the command button in SubForm2, which will open SubForm3. Note: SubForm2 is currently displayed in the Navigation Form.

In SubForm2, I have an "On Click" event procedure in which I am attempting to execute the following code, but can't get it to work.
Call Forms("Navigation Form").Controls("SubForm2").cmd_OpenSubForm3_Click
The Run-Time error "2465' (Microsoft Access can't find the field 'frm_Publication_Filter' referred to in your expression.) is returned

Thanks for your insight and help.
RJD
welcome2UA.gif

Hi Paul: Hard to know without seeing the setup and commands you are calling - but it sounds like it might be a syntax issue. When you call something referring to a subform you must use the following syntax...

Forms!MyMainForm!MySubform.Form! .... etc.

I guessed that since the error says "... the field 'frm_Publication_Filter' referred to in your expression". Since it says "field" I assume the .Form part is not there so that Access knows to look for a form instead of a control. Also are you using the Me! approach to any filtering? Are the procedures in form modules or general modules? Have you made the procedures public or private? Are these really subforms, or are they forms you open from another form? Is this really a Navigation Form, or is it a standard form used for navigation (a much better approach IMHO)? Could you just set up a procedure completely within the form rather than calling a procedure from another form?

But this is just a guess. If you could post more, including the event procedures behind the command buttons, perhaps we could diagnose this. Even better, if we could see the db itself ...

HTH
Joe
PaulWood
Joe,

Thanks for your efforts and suggestions. I tried several things to no avail. Finally, I took your suggestion to set up a procedure within the form. That solved the current dilemma. Now, I am faced with a similar, but different problem. I'll do some searching for clues and if not found will post here.

-Paul
RJD
Hi Paul. Good on the solution to the first issue. Let us know if we can assist on the new issue.

Regards,
Joe
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.