Re: Requery
- From: "Dirk Goldgar" <dg@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 4 Apr 2008 13:11:03 -0400
"aMack" <aMack@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:D7E3B0EF-29C7-4830-9052-9D7103FE9F72@xxxxxxxxxxxxxxxx
I have created an input form for new records from our main production form.
The main form does not refresh after the new record is added.
A "requery" command works when the form is opened from the Form objects menu
but not when initaited from our "Main Switchboard" form.
1) From Main Switchboard - Open form "Intermodal Transload"
2) From form "Intermodal Transload" initaite macro "Add New Order" - This
adds a new REF# to the data table Intermodal Transload and opens a form "Add
New Order".
3) Close form "Add New Record" with an "On Close" command:
Form(Intermodal_Transload).Requery
Why does this work when the form is opened from the object menu but does not
work when opened through the Main Switchboard?
Please help.
--
A MACKENZIE, CMA, MBA
I have no idea what is going on when you open the form from the object menu, but if this:
Form(Intermodal_Transload).Requery
.... is the line of code you are executing, it ought by rights to give you an error. Try this:
Forms!Intermodal_Transload.Requery
or this equivalent:
Forms("Intermodal_Transload").Requery
Bear in mind that a line of VBA code like that can't be placed directly in the OnClose property of your "Add New Order" form -- it has to be in an event procedure. The OnClose property should be set to "[Event Procedure]", and then the event procedure would look like:
Private Sub Form_Close()
Forms!Intermodal_Transload.Requery
End Sub
Actually, I'd recormmend checking to make sure the form is open, like this:
Private Sub Form_Close()
Const conTransloadForm As String = "Intermodal_Transload"
If CurrentProject.AllForms(conTransloadForm).IsLoaded Then
Forms(conTransloadForm).Requery
End If
End Sub
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
- References:
- Requery
- From: aMack
- Requery
- Prev by Date: How do I open an Excel template (xlt) from MS Access?
- Next by Date: Re: Strange multi-user timing phenomenon
- Previous by thread: Requery
- Next by thread: How do I open an Excel template (xlt) from MS Access?
- Index(es):
Relevant Pages
|