Form Requery Not Working

M

Mrstacy

The following code does not requery main menu. Any help is
appreciated.

Private Sub Form_Close()
If Me.Dirty Then
Me.Dirty = False
If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
Forms![Frm_Main_Menu].Requery
End If
End If

End Sub


Access 2003
Windows XP SP3
 
A

AkAlan via AccessMonster.com

try using refresh and not requery. This works for me.

If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then Form_Frm_Main_Menu.
Refresh
The following code does not requery main menu. Any help is
appreciated.

Private Sub Form_Close()
If Me.Dirty Then
Me.Dirty = False
If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
Forms![Frm_Main_Menu].Requery
End If
End If

End Sub

Access 2003
Windows XP SP3
 
M

Mrstacy

Didn't work :-(

try using refresh and not requery. This works for me.

If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then Form_Frm_Main_Menu.
Refresh




The following code does not requery main menu.  Any help is
appreciated.
Private Sub Form_Close()
   If Me.Dirty Then
       Me.Dirty = False
       If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
           Forms![Frm_Main_Menu].Requery
       End If
   End If
Access 2003
Windows XP SP3
 
M

Maurice

Maybe you have to set the focus to the form first if you are closing from an
other form then the form you are referring to. Just a guess but give it a
try...

so:

If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
Forms!Frm_Main_Menu.SetFocus
Forms![Frm_Main_Menu].Requery
End If


hth
--
Maurice Ausum


Mrstacy said:
It is a query

what are you using for the Frm_Main_Menu recordsource? Is it being loaded
dynamicaly from another form or is it bound?
Didn't work :-(
try using refresh and not requery. This works for me.
[quoted text clipped - 21 lines]
- Show quoted text -
 
M

Mrstacy

Didn't work again.

I should have said this earlier, but the code works when I attach it
to a button. However, if I allow the user to click the x to close the
form, it won't work. I may end up not allowing them to close the form
with an x.
Maybe you have to set the focus to the form first if you are closing from an
other form then the form you are referring to. Just a guess but give it a
try...

so:

If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
  Forms!Frm_Main_Menu.SetFocus
  Forms![Frm_Main_Menu].Requery
End If

hth
--
Maurice Ausum



Mrstacy said:
It is a query
what are you using for the Frm_Main_Menu recordsource? Is it being loaded
dynamicaly from another form or is it bound?
Mrstacy wrote:
Didn't work :-(
try using refresh and not requery. This works for me.
[quoted text clipped - 21 lines]
- Show quoted text -

- Show quoted text -
 
A

AkAlan via AccessMonster.com

Try putting the code on the On Close event of the form as well
Didn't work again.

I should have said this earlier, but the code works when I attach it
to a button. However, if I allow the user to click the x to close the
form, it won't work. I may end up not allowing them to close the form
with an x.
Maybe you have to set the focus to the form first if you are closing from an
other form then the form you are referring to. Just a guess but give it a
[quoted text clipped - 28 lines]
- Show quoted text -
 
M

Mrstacy

I'm not certain, but I think it is not working because the user's
insisted on a "submit" button. When they hit submit, the screen
clears for more data entry. Then if the screen is closed, it doesn't
trigger the dirty option.

Any ideas given what I said are appreciated.
Didn't work again.

I should have said this earlier, but the code works when I attach it
to a button.  However, if I allow the user to click the x to close the
form, it won't work.  I may end up not allowing them to close the form
with an x.
Maybe you have to set the focus to the form first if you are closing from an
other form then the form you are referring to. Just a guess but give it a
try...

If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
  Forms!Frm_Main_Menu.SetFocus
  Forms![Frm_Main_Menu].Requery
End If
Mrstacy said:
It is a query
what are you using for the Frm_Main_Menu recordsource? Is it being loaded
dynamicaly from another form or is it bound?
Mrstacy wrote:
Didn't work :-(
try using refresh and not requery. This works for me.
[quoted text clipped - 21 lines]
- Show quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
M

Mrstacy

It works if I put it on the form's close event and take out the
references to dirty. Will I run into problems though with just this?

If CurrentProject.AllForms("Frm_Main_Menu").IsLoaded Then
Forms![Frm_Main_Menu].Requery
End If


Try putting the code on the On Close event of the form as well
Didn't work again.
I should have said this earlier, but the code works when I attach it
to a button.  However, if I allow the user to click the x to close the
form, it won't work.  I may end up not allowing them to close the form
with an x.
Maybe you have to set the focus to the form first if you are closing from an
other form then the form you are referring to. Just a guess but give ita
[quoted text clipped - 28 lines]
- Show quoted text -
 
A

AkAlan via AccessMonster.com

I still think putting the code in the ON Close event or even the "submit"
button should work.
I'm not certain, but I think it is not working because the user's
insisted on a "submit" button. When they hit submit, the screen
clears for more data entry. Then if the screen is closed, it doesn't
trigger the dirty option.

Any ideas given what I said are appreciated.
Didn't work again.
[quoted text clipped - 39 lines]
- Show quoted text -
 

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

Top