Update the report

A

Ac

I have a form to take the data from user (the recode source is input table)
and a button on the form to open a report. There are several sub-reports on
this report, and sub reports’ recode source from different queries which use
the input table as the source. When the user update the input table from the
form, all the data on the queries are updated but not display on the report.
I would like to know the code for updating the report automatically. Thanks!
 
A

Arvin Meyer [MVP]

You need to force a save of the data before opening the report.

DoCmd.RunCommand acCmdSaveRecord
 
J

John W. Vinson

I have a form to take the data from user (the recode source is input table)
and a button on the form to open a report. There are several sub-reports on
this report, and sub reports’ recode source from different queries which use
the input table as the source. When the user update the input table from the
form, all the data on the queries are updated but not display on the report.
I would like to know the code for updating the report automatically. Thanks!

You need to save the record to disk prior to opening the report. In the
command button code put a line

If Me.Dirty Then Me.Dirty = False

before the OpenReport line.
 
A

Ac

Hi,

Thank you for all your replies. The report works well.

I have another question for this program. I created a chart based on the
chartData table, after the input table was changed, the data in chartData
table was changed too. But the chart did not change with the new data. I
tried the same method that added DoCmd.RunCommand acCmdSaveRecord or If
Me.Dirty Then Me.Dirty = False before the open report line, it still
displayed the same graph. Could you point out to me why? Thanks again!
 
A

Ac

Hi All,

I recreated the chart, now the chart is updated with the ChartData table.
The problem now is that there are 300 same charts in total, one in each page,
I only need one of them; there is no property like in the form (set
Navigation Buttons to NO) to eliminate the page number on the bottom of the
page. If the user prints the chart, he will have 300 pages of charts if he
prints in default status. I am not very sure where the ‘300’ comes from. I do
have 300 rows of data each time the calculation runs and new set of data (300
rows) will replace the old one inside of the ChartData table. Could you help
me for this problem? Thanks again!
 
J

John W. Vinson

Hi All,

I recreated the chart, now the chart is updated with the ChartData table.
The problem now is that there are 300 same charts in total, one in each page,
I only need one of them; there is no property like in the form (set
Navigation Buttons to NO) to eliminate the page number on the bottom of the
page. If the user prints the chart, he will have 300 pages of charts if he
prints in default status. I am not very sure where the ‘300’ comes from. I do
have 300 rows of data each time the calculation runs and new set of data (300
rows) will replace the old one inside of the ChartData table. Could you help
me for this problem? Thanks again!

I have no idea how you are constructing the ChartData table; it sounds like
you may be running a query which returns 300 records instead of just one. What
is the Recordsource of the chart? How are you creating or filling ChartData?
 
A

Ac

Hi John,

I had an input form taking the input from user and several queries did the
calculations. Based on the input data and the calculated results, I had to
create another table (originally it was in the Excel sheet, there were about
20 columns, and each time to run a batch calculation, it took about 300 rows
to complete. Lots of formulas in the cells used the data before or after
current rows or columns. I could not use the queries to do the calculation
because of this reason). I wrote a loop
inside of a module to calculate the results, and added the results into a
results table, finally I needed this table to create a chart inside of access
database. I finished all steps, it worked well.

The problem now is, there are 300 same charts displayed. I do not know where
those 300 charts are coming from; there are 300 new rows of data generated in
one batch calculation and replace the existing data in the ChartData table,
and the ChartData table is the data source of the chart. Is it the problem
coming from? How can I modify the code or properties to let only one chart
display. Your help is very much appreciated!
 
J

John W. Vinson

The problem now is, there are 300 same charts displayed. I do not know where
those 300 charts are coming from; there are 300 new rows of data generated in
one batch calculation and replace the existing data in the ChartData table,
and the ChartData table is the data source of the chart. Is it the problem
coming from? How can I modify the code or properties to let only one chart
display. Your help is very much appreciated!

I do not know either, and you're in a much better place to do so than I am:
you have the database and I don't!

My guess is that the chart's definition is to print one page per row of its
table, but a) I have little experience with charts and b) can't see your
chart's definition from here in any case.

I'd suggest posting a new thread to get other eyes on the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top