Updating Open Forms with New Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got a form called frmCriteria that generates SQL to restrict the records
that are displayed on frmForecast. When I change the criteria in
frmCriteria, I would like to have frmForecast immediately reflect the change
- without having to open and close frmForecast.

I entered this into the AfterUpdate event in frmCriteria:

Sub Form_AfterUpdate()
' Update frmForecast if it is open

If IsOpen("frmForecast") Then
Forms!frmForecast.Refresh
Forms!frmForecast.Requery
End If

End Sub

When I compile, I get a compile error - sub or function not defined. I'm no
VBA expert - I copied the code from a book, so I really don't know what's
wrong with it. Any ideas?
 
Kirk said:
I've got a form called frmCriteria that generates SQL to restrict the records
that are displayed on frmForecast. When I change the criteria in
frmCriteria, I would like to have frmForecast immediately reflect the change
- without having to open and close frmForecast.

I entered this into the AfterUpdate event in frmCriteria:

Sub Form_AfterUpdate()
' Update frmForecast if it is open

If IsOpen("frmForecast") Then
Forms!frmForecast.Refresh
Forms!frmForecast.Requery
End If

End Sub

When I compile, I get a compile error - sub or function not defined. I'm no
VBA expert - I copied the code from a book, so I really don't know what's
wrong with it. Any ideas?


You forgot to copy the code for the IsOpen function in the
book. It's not a built-in Access function. If you can't
find it in the book, look in the Northwinds sample database
on you Acccess install disk or just Google for many times it
has been posted.

Access 2002 does include an AllForms collection and an
IsLoaded property that can also be used for this purpose.
 
Back
Top