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

Refresh on Close

P: n/a
I guess this is a simple one but I can't seem to get it to work. I want to
refresh an open form "onClose" of another.

I have a Close button on a form which has User Details on it. If I update
the data on that from, I want it to automatically refresh the details which
are shown on an open form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.Close

On Close I want it to update the form frmMainMenu

Can someone help me?

Thanks in advance.

Apr 28 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi, Scott.

It sounds like you want to requery the other form, not refresh it.
Requerying a form means that the form retrieves all records from the
database that are part of its Record Source. That includes new records,
updates and deletions.

Refreshing only refreshes the data set that the form retrieved from the
database when it was first opened or when the form was last requeried. It
won't reflect updates to the data that were carried out by other users or
other processes, such as your other form.
I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
That's VBA 4.0, which was deprecated a long time ago. You don't want to use
that. Use the current VBA version for your application, which is VBA 6.x,
unless you're using Access 97. Access 97 uses VBA 5.0.
On Close I want it to update the form frmMainMenu
To requery the other form, try:

Forms("frmMainMenu").Requery
DoCmd.Close acForm, Me.Name

To refresh the other form, try:

Forms("frmMainMenu").Refresh
DoCmd.Close acForm, Me.Name

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...I guess this is a simple one but I can't seem to get it to work. I want to
refresh an open form "onClose" of another.

I have a Close button on a form which has User Details on it. If I update
the data on that from, I want it to automatically refresh the details
which are shown on an open form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.Close

On Close I want it to update the form frmMainMenu

Can someone help me?

Thanks in advance.

Apr 28 '06 #2

P: n/a
forms!frmMainMenu.refresh
docmd.close acform, me.name

(Good to specify the name of the form to close to avoid problems, especially
if the focus might get shifted to the other form by the refresh command.)
hope this helps
-John
"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
I guess this is a simple one but I can't seem to get it to work. I want to
refresh an open form "onClose" of another.

I have a Close button on a form which has User Details on it. If I update
the data on that from, I want it to automatically refresh the details
which are shown on an open form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.Close

On Close I want it to update the form frmMainMenu

Can someone help me?

Thanks in advance.

Apr 28 '06 #3

P: n/a
Thanks for the info. Either of the two scenarios you sent work. The only
thing is it doesn't clost the open form. Main Menu requeries, but the form
"frmRepDetails" stays open and I get an error message "Method or Data not
found.

I replaced "Me.Name" with Me.frmRepDetails" thinking it would close the
form.

Sorry, am very much a novice but appreciate your help.

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AM> wrote in
message news:yZ******************************@adelphia.com ...
Hi, Scott.

It sounds like you want to requery the other form, not refresh it.
Requerying a form means that the form retrieves all records from the
database that are part of its Record Source. That includes new records,
updates and deletions.

Refreshing only refreshes the data set that the form retrieved from the
database when it was first opened or when the form was last requeried. It
won't reflect updates to the data that were carried out by other users or
other processes, such as your other form.
I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70


That's VBA 4.0, which was deprecated a long time ago. You don't want to
use that. Use the current VBA version for your application, which is VBA
6.x, unless you're using Access 97. Access 97 uses VBA 5.0.
On Close I want it to update the form frmMainMenu


To requery the other form, try:

Forms("frmMainMenu").Requery
DoCmd.Close acForm, Me.Name

To refresh the other form, try:

Forms("frmMainMenu").Refresh
DoCmd.Close acForm, Me.Name

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
I guess this is a simple one but I can't seem to get it to work. I want to
refresh an open form "onClose" of another.

I have a Close button on a form which has User Details on it. If I update
the data on that from, I want it to automatically refresh the details
which are shown on an open form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.Close

On Close I want it to update the form frmMainMenu

Can someone help me?

Thanks in advance.


Apr 28 '06 #4

P: n/a
All good. Got it working!

Thanks guys for your time :o)

"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
Thanks for the info. Either of the two scenarios you sent work. The only
thing is it doesn't clost the open form. Main Menu requeries, but the form
"frmRepDetails" stays open and I get an error message "Method or Data not
found.

I replaced "Me.Name" with Me.frmRepDetails" thinking it would close the
form.

Sorry, am very much a novice but appreciate your help.

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AM> wrote
in message news:yZ******************************@adelphia.com ...
Hi, Scott.

It sounds like you want to requery the other form, not refresh it.
Requerying a form means that the form retrieves all records from the
database that are part of its Record Source. That includes new records,
updates and deletions.

Refreshing only refreshes the data set that the form retrieved from the
database when it was first opened or when the form was last requeried.
It won't reflect updates to the data that were carried out by other users
or other processes, such as your other form.
I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70


That's VBA 4.0, which was deprecated a long time ago. You don't want to
use that. Use the current VBA version for your application, which is VBA
6.x, unless you're using Access 97. Access 97 uses VBA 5.0.
On Close I want it to update the form frmMainMenu


To requery the other form, try:

Forms("frmMainMenu").Requery
DoCmd.Close acForm, Me.Name

To refresh the other form, try:

Forms("frmMainMenu").Refresh
DoCmd.Close acForm, Me.Name

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
I guess this is a simple one but I can't seem to get it to work. I want
to refresh an open form "onClose" of another.

I have a Close button on a form which has User Details on it. If I
update the data on that from, I want it to automatically refresh the
details which are shown on an open form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.Close

On Close I want it to update the form frmMainMenu

Can someone help me?

Thanks in advance.



Apr 28 '06 #5

P: n/a
You're welcome! Glad it helped.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
All good. Got it working!

Thanks guys for your time :o)

"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
Thanks for the info. Either of the two scenarios you sent work. The only
thing is it doesn't clost the open form. Main Menu requeries, but the
form "frmRepDetails" stays open and I get an error message "Method or
Data not found.

I replaced "Me.Name" with Me.frmRepDetails" thinking it would close the
form.

Sorry, am very much a novice but appreciate your help.

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AM> wrote
in message news:yZ******************************@adelphia.com ...
Hi, Scott.

It sounds like you want to requery the other form, not refresh it.
Requerying a form means that the form retrieves all records from the
database that are part of its Record Source. That includes new records,
updates and deletions.

Refreshing only refreshes the data set that the form retrieved from the
database when it was first opened or when the form was last requeried.
It won't reflect updates to the data that were carried out by other
users or other processes, such as your other form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

That's VBA 4.0, which was deprecated a long time ago. You don't want to
use that. Use the current VBA version for your application, which is
VBA 6.x, unless you're using Access 97. Access 97 uses VBA 5.0.

On Close I want it to update the form frmMainMenu

To requery the other form, try:

Forms("frmMainMenu").Requery
DoCmd.Close acForm, Me.Name

To refresh the other form, try:

Forms("frmMainMenu").Refresh
DoCmd.Close acForm, Me.Name

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and
tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"scott" <sc**********@maneyacts.com> wrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
I guess this is a simple one but I can't seem to get it to work. I want
to refresh an open form "onClose" of another.

I have a Close button on a form which has User Details on it. If I
update the data on that from, I want it to automatically refresh the
details which are shown on an open form.

I was going to use the default access code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.Close

On Close I want it to update the form frmMainMenu

Can someone help me?

Thanks in advance.




Apr 28 '06 #6

P: n/a
scott wrote:
Thanks for the info. Either of the two scenarios you sent work. The only
thing is it doesn't clost the open form. Main Menu requeries, but the form
"frmRepDetails" stays open and I get an error message "Method or Data not
found.

I replaced "Me.Name" with Me.frmRepDetails" thinking it would close the
form.

Sorry, am very much a novice but appreciate your help.


Sometimes it's best to close a form Explicitly. Here's probably what
you have/had
Docmd.Close

You could do this instead
Docmd.Close acForm, Me.Name
Apr 28 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.