Refresh Report Data

fabioltj

Fabio Juliato
Local time
Today, 07:19
Joined
Sep 8, 2005
Messages
15
I have one report based on my table and form (off course).

My problem is: when I add a new record in the database (via table or form), this new record does not show up in my report .... your "space" show up blank

What I need to do to refresh these records ? Or what's the problem

Thanks in advance
Fabio
 
If you are running the report from the form where you added the new record, the problem is that the new record has not yet been saved to the table so the report cannot see it. Add a line of code in front of the DoCmd.OpenReport line to force Access to save the current record:

DoCmd.RunCommand acCmdSaveRecord
 
no data shows on the report.

Hi,
I use the code "acCmdSaveAllRecords" in front of the DoCmd.OpenReport to force Access to save all records into the table tblSample, but it pops up an error saying, "the RunCommand action was cancelled". Do you know why is that?

Also, when I check tblSapme, the data ae there; the query (record source for tblSample), data is there, but when I open the report, the datata is not there.
pls help-thank you
 
I don't know what acCmdSaveAllRecords does. I see it in the acCommand list in the DoCmd.RunCommand help entry but it is not in the acCommand list of the Object Browser. So, why not use the command I suggested. If you are reporting on the current record, that is the record that needs saving. acCmdSaveRecord WILL save the current record.

Here's a link to a thread I found via Google
http://home.clara.net/tkwickenden/list/lists.htm
 
Last edited:
The report to show all records

Thank you for your help. I would like to save all records to show on the report because that's the requirement. Also, I have a loop to assign values into tblSample as following:
Do Until rsG.EOF
rsSample.AddNew
rsSample.Fields(1) = rsS.Field(1)
rsSample.Fields(2) = rsS.Fields(2)
rsSample.Fields(3) = rsS.Fields(3)

rsSample.Update
rsS.MoveNext
Loop

I think rsSample.Update already do the saving job, but I don't know why the report does not show up the records.

I try the code DoCmd.RunCommand acCmdSaveRecord, but it does not show data either. Do you have any idea??? Thanks
 
save all records
Access saves records one at a time. Unless you have multiple forms open, there will never be more than one record to save.

Why are you not using a bound form? It is not nectssary to update the current record via code and in fact, frequently causes contention problems.
 
requery

Hi,
Thank you for your time and effort. I guess I am able to solve the problem. I use requery and the report now shows the data.

Thank you again,
Tim
 
DO NOT USE requery to force Access to save the current record. It has side effects you will not like. Why don't you want to use the command I suggested?
 
It sounds like that report is staying open in the background.
Maybe you should do both, use

DoCmd.RunCommand acCmdSaveRecord
then requery the report.
 
--Quote--
DO NOT USE requery to force Access to save the current record. It has side effects you will not like. Why don't you want to use the command I suggested?
--Quote--

Like I said in the previous post, I use DoCmd.RunCommand acCmdSaveRecord but it does not work; the report does not show up the data :(.
 
If requery works in the exact same spot as the save record command does not work, then they are not working on the same recordset. Please do not be offended by my emphatic statement because I am trying to help you. Requery does exactly what it says. It runs a query again. As a byproduct, if you are requering the recordset of a form, Access first saves the current record if it is dirty. Sounds to me like your requery is not of the current form. Sounds like it is requerying some other recordset.

jsanders offered a possible suggestion as to what might be the problem.
 
Thanks

I was having a similar problem and Pat Hartman's suggestion of using "DoCmd.RunCommand acCmdSaveRecord" fixed it. I needed a quick solution and this was just the job so many thanks! :)
 
Welcome aboard:) Looks like you used the search feature successfully:):)
 

Users who are viewing this thread

Back
Top Bottom