Report not updating consistently

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been having problems with an Access report that was passed down to me.
It has a form that is used to run a query, which searches the table for data
that falls under certain parameters which were entered in the form. The
information from the query is then outputted into a report.

The problem is that the information in the report usually does not reflect
the criteria that I entered into the form (previous results are shown
instead).

I went through the query and the report to see if the links looked correct,
which they did.

Why is the report not showing the most recent results all of the time?
 
QuantumLeap,
If you're running the report directly from the form you just entered data
into, you'll have to do an Update or Refresh just before the report runs.
Your new data hasn't been sent to the table yet.
Private Sub cmdYourReport_Click()
Refresh
DoCmd.OpenReport "rptYourReport"
End Sub
 
Quantum,
How do you open the report now?
Don't you have a button on your form that you click to open the report?
The code I wrote would be placed in the OnClick Event Procedure for that
button.

From your question, I'm going to assume that you may not have coded an
Event Procedure before.

On your form, place a button and name it "cmdPrintReport."
In form design, select the button, find the On Click property for the
button, and place your cursor in the text box for the On Click property.
An arrow appears on the right of the box... click it, and select Event
Procedure.
You'll also see a button with 3 dots (...) on the right. Click it, and
you'll move to the module behind the form.
You'll see this...
-----------------------------------------
Private Sub cmdPrintReport_Click()

End Sub
----------------------------------------
This is the code that will run when the button is clicked on the form...
it's empty now, so we'll insert the following code.
-----------------------------------------
Private Sub cmdPrintReport_Click()
Refresh
DoCmd.OpenReport "UseYourOwnReportNameHere", acViewPreview
End Sub
----------------------------------------
This code says... "when the button on the form is Clicjed, Refresh the
values on the form, and open my report in PrintPreview mode.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
I tried inserting the code that you gave me, but I still get the old report.

What else may fix this problem?

Thanks
 
Back
Top