Use Refresh/Requery

G

grahamswindon

I have a subform that I use to update information - for example an end
date - a summary of which transactions are accessed by clicking a
control button opening another form and subform. I want the user to
be able to click the control button and see the summary form with the
information updated without first having to click out of the record.

I have tried using refresh and requery in all sorts of locations but
to no avail. The user has to click out of the record and then click on
the control button to see the other form/subform displayed correctly.

Any ideas, anyone?
 
T

Tony Toews [MVP]

I have a subform that I use to update information - for example an end
date - a summary of which transactions are accessed by clicking a
control button opening another form and subform. I want the user to
be able to click the control button and see the summary form with the
information updated without first having to click out of the record.

I have tried using refresh and requery in all sorts of locations but
to no avail. The user has to click out of the record and then click on
the control button to see the other form/subform displayed correctly.

docmd.runcommand accmdsaverecord
forms![other form name]!requery

And you might need to do something like
forms![other form name].forms[sub form name]!requery
but I don't recall if this is the exact syntax.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
G

grahamswindon

I have a subform that I use to update information - for example an end
date - a summary of which transactions are accessed by clicking a
control button opening another form and subform. I want the user to
be able to click the control button and see the summary form with the
information updated without first having to click out of the record.
I have tried using refresh and requery in all sorts of locations but
to no avail. The user has to click out of the record and then click on
the control button to see the other form/subform displayed correctly.

docmd.runcommand accmdsaverecord
forms![other form name]!requery

And you might need to do something like
forms![other form name].forms[sub form name]!requery
but I don't recall if this is the exact syntax.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems athttp://www.granite.ab.ca/accsmstr.htm

Thanks for the help Tony - but where exactly should I put the code? In
the afterupdate property of the date box?
 
T

Tony Toews [MVP]

Thanks for the help Tony - but where exactly should I put the code? In
the afterupdate property of the date box?

An afterupdate event yes. Of which field? Whatever is appropriate
to your situation.

Note that you will want to save the record first otherwise the other
form won't see the update..

If me.dirty then docmd.runcommand accmdsaverecord.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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

Similar Threads


Top