Trying to requery form when data is added

  • Thread starter Thread starter Chips
  • Start date Start date
C

Chips

I have one table [TblVolunteers] that has names, addresses, etc. Another
table [TblDonations] keeps track of instances when a volunteer does
something. The form for TblDonations has a combo box so one can choose a
volunteer after starting out with a date (when adding a "donation" record).
I have a button on the FrmDonations that opens the FrmVolunteer so one can
edit or add volunteers.

I want the "volunteers" combo box in the FrmDonations to requery when the
FrmVolunteers is updated.

I put this code in the After Update event for FrmVolunteer:

Private Sub Form_AfterUpdate()
'Update [FrmDonations] if it is open after [FrmVolunteer] is edited

If IsOpen("FrmDonations") Then
Forms!FrmDonations.Requery
End If
End Sub

Unfortunately it isn't working. When I add a record in FrmVolunteer and
close it, I get an error: "Compile Error - Sub or Function not defined".
If I delete a record, I don't get an error message, but it also doesn't
requery the combo box.

Would really appreciate advise on how to get this to work.

Thanks,

GC
 
Never mind earlier post.

I looked earlier in my book, and see that "IsOpen" is a public function I
have to write, it's not already par of Access.

GC
 
If you need help try this link:

http://www.mvps.org/access/forms/frm0002.htm


Never mind earlier post.

I looked earlier in my book, and see that "IsOpen" is a public function I
have to write, it's not already par of Access.

GC


Chips said:
I have one table [TblVolunteers] that has names, addresses, etc. Another
table [TblDonations] keeps track of instances when a volunteer does
something. The form for TblDonations has a combo box so one can choose a
volunteer after starting out with a date (when adding a "donation" record).
I have a button on the FrmDonations that opens the FrmVolunteer so one can
edit or add volunteers.

I want the "volunteers" combo box in the FrmDonations to requery when the
FrmVolunteers is updated.

I put this code in the After Update event for FrmVolunteer:

Private Sub Form_AfterUpdate()
'Update [FrmDonations] if it is open after [FrmVolunteer] is edited

If IsOpen("FrmDonations") Then
Forms!FrmDonations.Requery
End If
End Sub

Unfortunately it isn't working. When I add a record in FrmVolunteer and
close it, I get an error: "Compile Error - Sub or Function not defined".
If I delete a record, I don't get an error message, but it also doesn't
requery the combo box.

Would really appreciate advise on how to get this to work.

Thanks,

GC
 
Back
Top