Form Requery Not Working

  • Thread starter Thread starter Mrstacy
  • Start date Start date
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
 
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
 
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 -
 
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 -
 
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 -
 
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 -
 
Back
Top