By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

Getting data to refresh automatically

P: 44
I have a form for entering various contract information. On that form there are some fields that contain the total budget for the contract, which is a single field in the 'Contracts' table, which is the data source for the table. There is also a field for total invoices and the remaining unspent amount in the contract. The total invoices sum up the amounts from the "Invoices" table for all invoices with that Contract No.
I have a button on the 'Contract' form that opens an 'Invoice' form. The 'Invoice' form shows all existing invoices for the contract and allows you to enter new ones. Then you close the form and you're back to the contract form.
All of this is working fine.
Here's the thing though: When it goes back to the contract form the total invoice amount isn't updated to reflect the changes that were made. If I manually refresh the record it all comes in, but I don't want people to have to know to do that. I haven't been able to find an event where I can put the Refresh command that makes it happen automatically. Can anyone tell me what will do it?
Thanks you.
Feb 7 '08 #1
Share this Question
Share on Google+
2 Replies

P: 20
Assuming that you have [frmContracts] open at the same time as [frmInvoices], then you can trigger a refresh of the first form in the close function from the second form:


You can also requery the Total amount, assuming it feeds from a query:


Hope that helps!

EDIT: Sorry, forgot to include you can put this in the Form_Close() event. (doh)
Feb 7 '08 #2

P: 44
Thanks. I used your first suggestion. Much more straightforward than what I was trying to do. (I was trying to get DoCmd.RunCommand AcCmdRefresh to do it, and couldn't figure out how to point it to the Contract table from Event code from the other form.)
Feb 8 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.