jtwardowski
Technical User
Hello,
I am a novice at using VB. I took a class a few years ago and have not used it since. I am using Access 2002 and I am trying to requery a field in my subform after a field in my main form is updated. I figured an AfterUpdate Event Procedure would be appropriate, but not quite sure how to do it. My main form is called frm_Sheet_Information and my subform is called sfrm_Treatment_Data. The field I want to trigger the event on the main form is Zone and the field I want to requery on the subform is Unit. I tried to create some code, but when I ran it, it asked for a macro so now I have the following which results in a Runtime error 2465: Application defined or object defined error. The debug feature says it is in the mac_units subroutine.
Private Sub Zone_AfterUpdate()
DoCmd.OpenForm "sfrm_Treatment_Data"
Dim rst As Recordset
Set rst = [frm_Treatment_Data Subform].Unit
mac_units
End Sub
Sub mac_units()
Forms.frm_Sheet_Information.sfrm_Treatment_Data.Unit.Requery
End Sub
I'm sorry to bother you with what is probably a simple problem.
Any input would be appreciated.
Thanks,
Julie
I am a novice at using VB. I took a class a few years ago and have not used it since. I am using Access 2002 and I am trying to requery a field in my subform after a field in my main form is updated. I figured an AfterUpdate Event Procedure would be appropriate, but not quite sure how to do it. My main form is called frm_Sheet_Information and my subform is called sfrm_Treatment_Data. The field I want to trigger the event on the main form is Zone and the field I want to requery on the subform is Unit. I tried to create some code, but when I ran it, it asked for a macro so now I have the following which results in a Runtime error 2465: Application defined or object defined error. The debug feature says it is in the mac_units subroutine.
Private Sub Zone_AfterUpdate()
DoCmd.OpenForm "sfrm_Treatment_Data"
Dim rst As Recordset
Set rst = [frm_Treatment_Data Subform].Unit
mac_units
End Sub
Sub mac_units()
Forms.frm_Sheet_Information.sfrm_Treatment_Data.Unit.Requery
End Sub
I'm sorry to bother you with what is probably a simple problem.
Any input would be appreciated.
Thanks,
Julie