Combo Box Selection/filter not applying when using Navigation Form (1 Viewer)

Paul Gonzaga

New member
Local time
Today, 06:38
Joined
Jun 8, 2020
Messages
14
Hi there,
I have created a Navigation form thinking it would ease form and report navigation. I have added my forms to Navigation buttons. However, when for instance i want to generate a report, i click on the report Navigation button with the form, the form is displayed but when i choose the filter from the combo box (in this case a month) and click the button to open report, am prompted to enter the Parameter Value for the combo box. How am i supposed to reference forms on a Navigation Form?


Note: My forms work well if directly run.

I appreciate your help.

Paul
 

June7

AWF VIP
Local time
Yesterday, 19:38
Joined
Mar 9, 2014
Messages
5,470
Are you using dynamic parameterize query as report RecordSource?

Where is combobox located - main form or a subform? You are embedding report on form?

Nature of navigation form is that only one subform/subreport is available at a time. They are loaded/unloaded when tabs are clicked.

If you want to provide db for analysis, follow instructions at bottom of my post.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:38
Joined
May 7, 2009
Messages
19,233
yes, you need to add Reference to your Navigation Form and Navigation Subform on your Query critera:

[Forms]![NavigationFormName]![NavigationSubformName].[Form]!comboBoxName
 

Paul Gonzaga

New member
Local time
Today, 06:38
Joined
Jun 8, 2020
Messages
14
yes, you need to add Reference to your Navigation Form and Navigation Subform on your Query critera:

[Forms]![NavigationFormName]![NavigationSubformName].[Form]!comboBoxName
Hi,
This format isnt working. I get the same prompt:

Take a look at my set up:
Navigation Form =Main
Subform =frmDateSelection (Mapped onto "Report" button)
frmDateSelection has a Combo box "cboMonth"
frmDateSelection has a Command Button "Open Report" which when clicked, should open the report for the month selected at the Combo.

Here is [Forms]![Main]![frmDateSelection].[Form]![cboMonth]. I have put this in the criteria of my query but still getting the prompt for parameter value.

Note: Does it matter if the Navigation Form is a '2 Levels' form?


Thanks,
Paul
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:38
Joined
May 7, 2009
Messages
19,233
the frmDateSelection is Inside the NavigationSubform, right!?
then use the NavigationSubform name instead of frmDateSelection:

[Forms]![Main]![navigation_sub_form_name].[form]![cboMonth]
 

June7

AWF VIP
Local time
Yesterday, 19:38
Joined
Mar 9, 2014
Messages
5,470
I would not use dynamic parameter in query. I prefer using WHERE CONDITION argument of OpenReport. If code is behind form holding combobox, then:

DoCmd.OpenReport "reportname", , , "somefield=" & Me.cboMonth

Does criteria need to consider year as well as month?

Suggest you provide db for analysis.
 

mistyinca1970

Member
Local time
Yesterday, 20:38
Joined
Mar 17, 2021
Messages
117
the frmDateSelection is Inside the NavigationSubform, right!?
then use the NavigationSubform name instead of frmDateSelection:

[Forms]![Main]![navigation_sub_form_name].[form]![cboMonth]

OK, this is also not working for me. I have a criteria in the line of my query as follows:
Code:
[Forms]![frmContracts]![ID]

This works great when frmContracts is opened on its own, but when it is within the navigation form, I get prompted for the parameters.

So I tried the recommendation above. The Navigation form is called frmContrax. While entering the criteria in the query builder, it doesn't even pop up the options to draft it this way. So I typed it in manually, but it doesn't work. I tried the following:

Code:
[Forms]![frmContrax]![frmContracts].[form]![ID]
And here is the query:
Code:
SELECT tblContracts.ID, tblContracts.ContractNo, tblContracts.ContractEntity, tblContractType.Abbreviation, tblContracts.ContractType, tblContracts.AssignedMonitor, tblContracts.Parity, tblContracts.OriginalDate, tblContracts.ContractDate, tblContracts.ExpirationDate, tblContracts.EffectiveExpDate, [ContractEntity] & " (" & [Abbreviation] & ")" AS ContractName
FROM tblContracts INNER JOIN tblContractType ON tblContracts.ContractType = tblContractType.ContractType
WHERE (((tblContracts.ID)=[Forms]![frmContrax]![frmContracts].[form]![ID]));

Here's a snapshot of the navigation form (frmContrax) and the form within the navigation form (frmContracts). I'm trying to run a report on a query where the criteria pulls the record from the ID (primary key) . I can't get it to work while opened in the Navigation form.
contracts.PNG
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:38
Joined
Oct 29, 2018
Messages
21,467
Hi. The syntax is merely this.

Forms!NavigationFormName.SubformContainerName.Form!TextboxName

It's very important to use the name of the subform container, rather than the name of the form it contains.
 

mistyinca1970

Member
Local time
Yesterday, 20:38
Joined
Mar 17, 2021
Messages
117
Hi. The syntax is merely this.

Forms!NavigationFormName.SubformContainerName.Form!TextboxName

It's very important to use the name of the subform container, rather than the name of the form it contains.
The form isn't actually a subform (unless you mean that any form within a navigation form is a subform).

contracts2.PNG
 

mistyinca1970

Member
Local time
Yesterday, 20:38
Joined
Mar 17, 2021
Messages
117
OK I got it with this:
Code:
[Forms]![frmContrax].[nsfContainer].[Form]![ID]
 

mistyinca1970

Member
Local time
Yesterday, 20:38
Joined
Mar 17, 2021
Messages
117
Glad to hear you got it sorted out. Good luck with your project.
Thank you for the help. It was a bit confusing in the nomenclature because I didn't know we're referring to the Target form as a subform, and I also did not understand what you meant by "container" until I started clicking around within the navigation form to see that there is a box around the target form with a default name of NavigationSubform. Interesting that that does not change when you tab through the buttons in the Navigation Form.

I am now wondering if this is why I get an error 2046 on some macros (command or action isn't available right now) where the button triggering the macro is on a form within a navigation form...
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:38
Joined
Oct 29, 2018
Messages
21,467
Thank you for the help. It was a bit confusing in the nomenclature because I didn't know we're referring to the Target form as a subform, and I also did not understand what you meant by "container" until I started clicking around within the navigation form to see that there is a box around the target form with a default name of NavigationSubform. Interesting that that does not change when you tab through the buttons in the Navigation Form.

I am now wondering if this is why I get an error 2046 on some macros (command or action isn't available right now) where the button triggering the macro is on a form within a navigation form...
Hi. I called it a container, but the proper name is "control," as in Subform/Subreport Control.
 

June7

AWF VIP
Local time
Yesterday, 19:38
Joined
Mar 9, 2014
Messages
5,470
The nature of Navigation form is that only one subform at a time is available - there is only one Navigation Subform container. Clicking the 'tabs' unloads and loads forms into this one container. This is why the container name does not change. This is different from using a Tab control where multiple subforms sit on different pages of Tab control - containers are static, each bound to a specific form.
 

Users who are viewing this thread

Top Bottom