Requery report subform

shawda

New member
Local time
Tomorrow, 08:20
Joined
Mar 2, 2011
Messages
5
I have a small database for keeping a track of what IT equipment we have in stock,

The main form (Frm_Main1) contains 3 subforms, one for checking equipment in (Frm_Check in), another subform for updating records when equipment is sent out (Frm_CheckOut) and finally I have a report that shows the current products that we have avaialble (Rpt_StockLevel),

What I would like to do is requery the report each time a record is saved, any help would be appriciated.

PS built with 2010

Thanks
Damon
 

Attachments

Last edited:
sorry, have converted to .mdb
 

Attachments

when you open the report it's not updated ?
 
when i open the main form it updates fine, but when i add or update a record using one of the other sub forms i want the report to update and show the change in available stock, basicaly a running total of what is available.

here's a screen shot
 

Attachments

  • Untitled-2.jpg
    Untitled-2.jpg
    68 KB · Views: 189
You have not shown a REPORT. I see a form. If the report is not open when you do the update it will have the data there as long as the record has been saved. If you have the report open, then you need to have the code close it and reopen it. You can use

Application.Echo False

before closing and reopening it and then
Application.Echo True
after that code so then it doesn't look like it did close and reopen.
 
I can assure you it is a report, I created the report as normal and simply clicked and dragged it into the main form, and if you go into the forms design view and click on it, it says "Selection type: Report", if you open the .mdb i posted earlier and try to open frm_main1 it comes back saying it is not possible to open a report in a form... this obviously seems to be resolved in 2010

If no one knows how this works, is it possible to desplay query data that will grow/shrink and display like a report? or something similar to the screen shot?
 
the idea of report is to open it when you want it to be printed or sent, not to have it open all time and be updated for every data change.
for this you use forms.

even if it's possible, why whould you put a report on a form ? I never saw any reason to try this.
You can create the totals in the subforms, using the Header/footer, exactly the same way it's done in report.

As Bob said, if you want a report to be updated you must have a code to close it and reopen it.
 
THIS IS POSSIBLE!! but thanks for all your suggestions....

After trying lots of different things i found that a simple subform requery did the job,

[Forms]![Frm_Main1].[Form]![Rpt_StockLevel].Requery
[Forms]![Main Form].[Form]![Subform].Requery

After adding this to the save record button on my other subforms my report now updates with the new totals as i go,
I did have to change the save record button from a macro to an event to add the code and did it with this,

Private Sub save_and_add_Click()
Recordset.AddNew
DoCmd.RunCommand acCmdSaveRecord
Me!Brand.SetFocus
[Forms]![Frm_Main1].[Form]![Rpt_StockLevel].Requery
End Sub

Have included a copy of the database for the naysayers, you will need Access 2010 for this to work.
 

Attachments

Thanks Shawda for posting this. I was able to utilize this on one of my forms.

Thanks
 

Users who are viewing this thread

Back
Top Bottom