Enter Parameter Value Error : Form/SubForm

mpspeer

Registered User.
Local time
Today, 16:14
Joined
Nov 6, 2012
Messages
18
Hi All-

I have researched this and understand I need to change my query critera to account for the subform, but it is still asking for parameter values after this update..

Summary:
I have two Date Picker Boxes on the sub form which tells the query the date ranges which populates a pivot chart. The form works perfectly as a stand alone with the critera of:

Code:
 >=[Forms]![frmDateChart]![StartD] And <=[Forms]![frmDateChart]![EndD]

I then placed this form in to the main form and got a parameter value error, so I researched and changed my criteria to this to account for the subform as I have read on this forum:

Code:
 >=[Forms]![frmCostTracker]![frmDateChart].[Form]![StartD] And <=[Forms]![frmCostTracker]![frmDateChart].[Form]![EndD]

Where frmCostTracker is the main form, frmDateChart is the subform, and StartD and EndD are my Date Picker Text Boxes.

Yet I still get the parameter value error, I also now I get it on both the subform and on the form if I open it stand alone.

Any Ideas?
 
There is something wrong with the reference. frmDateChart must be the name of the subform control, not the name of the subform object. I use sfrm as the prefix for my subforms to distinguish them from main forms. If you used the wizard to place the subform, Access probably named it [frmDateChart sub] or something like that. Click on the name property to see what Access called it. You can change the name to eliminate the space.

Yeah I figured it out a couple mins after I posted this, that's exactly the issue.

I do have another question, though. I use these Date Range boxes to populate a pivot chart (ran from a query)on the subform, so obviously the design of the query changes accordingly.
Therefore, when I click the another subform tab I get the message "Do you want to save changes to the design on query 'qryEntriesChart'?

Is there a way to emliminate this?
 
Code:
 >=[Forms]![frmCostTracker]![frmDateChart].[Form]![StartD] And <=[Forms]![frmCostTracker]![frmDateChart].[Form]![EndD]

Why are you changing the query each time? Queries take arguments that can be supplied at runtime.

Select ...
From ...
Where somefield = Forms!myform!myfield;

or
Select ...
From ...
Where somefield = [enter value for somefield];

The first example will pick up the value from a control in an OPEN form. The second will prompt for a value each time it runs. The first method is usually preferable, especially for reports because Access won't ask again for the parm when you switch from preview to print.

I'm using the criteria quoted above (Well, the fixed version with the correct names) for the Date section of my query, and linking it to the two date range boxes on the form for its parameter.

When the user changes the date ranges and populates the Pivot Chart, it changes the design of the chart because there is now data in it/showing, no?

That's why it asks do I want to save the new design, I assume, because instead of an empy chart, I actually have bars of data.

EDIT: Additional information as to why the query is changing design... The query is showing in PivotChart view on the form... so the design changes when different date parameters are entered, therefore asking if I want to save the new design, though nothing 'in' the query changes specifically.

Am I wrong on this? The only thing changing within the form, is the implementation of date ranges and populating a bar chart.
 

Users who are viewing this thread

Back
Top Bottom