Chart

  • Thread starter Thread starter tsluu
  • Start date Start date
T

tsluu

On form load, I am a creating a new query replacing the old one for use by
the me.recordsource. I have to run the form twice in order to see the effect
of the new parameters. How can I do it without running the form twice. I
guess the first run was replacing the old query and second execution will see
the effect of the new query
 
What old query is that? If you are setting the Record Source at runtime,
just do that. You do not need to have anything set in the form's Record
Source property. How are you replacing the query?
 
at design time I have set pivotChartForm.recordsource to qrySample, which is
"Select * From tblAccount". What I want to do is during runtime, I wish to
get certain conditions from the user as to which accounts to retrieve before
I call the form with the pivot chart. How do I do that? It seems that the
pivotChartForm uses the old query "Select * From tblAccount" during form_load
instead of "Select * From tblAccount where [ac#] is between '001' and '015';
 
If you are having trouble with code, post the code.

Again, if you are setting the Record Source at runtime, there is no need to
assign the Record Source on the form's Property Sheet. However, it seems to
me you should be able to reassign the Record Source in the form's Load
event, so there could be a problem with the code. In the form's Load event:

Dim strSQL as String
strSQL = "SELECT * FROM tblAccount WHERE [ac#] Between '001' And '015'"

Me.RecordSource = strSQL

You do not say how you are getting the user input to specify the range 001
to 005. It could be you should use the qrySample as the Record Source
property. Modify qrySample so that you have something like this as the
Criteria for [ac#]:

Between [Enter starting Account Number] And [Enter ending Account Number]

This will prompt the user for the values when you open the form.

BTW, you should use only alphanumeric characters and underscores in names.
You should especially avoid the use of special characters such as # that
have a special meaning in Access. Use letters, numbers, and underscores
only.

tsluu said:
at design time I have set pivotChartForm.recordsource to qrySample, which
is
"Select * From tblAccount". What I want to do is during runtime, I wish to
get certain conditions from the user as to which accounts to retrieve
before
I call the form with the pivot chart. How do I do that? It seems that the
pivotChartForm uses the old query "Select * From tblAccount" during
form_load
instead of "Select * From tblAccount where [ac#] is between '001' and
'015';

BruceM said:
What old query is that? If you are setting the Record Source at runtime,
just do that. You do not need to have anything set in the form's Record
Source property. How are you replacing the query?
 
Back
Top