A
Access infant
Hi All,
I have a problem with finding the name of the present subform in the main
form. Before coming to the problem,let me give a background of the design
Actually every first level subform is unbound and they hold one or two
second level subforms which are bound to tables and are in one- to- many
relation with the mainform. And every level1 subform has two navigation
buttons ".Next > ", "< Back ". the code in the click event of these buttons
see what form follows next. The code is as follows.
Me.Parent.sfrmholder.SourceObject = "sfrm to come next" etc...
Now i want the second level forms to display records related to the record
in the main form. the code is i used in the current event of the main form is:
Me!sfrmholder.Form!sfrm11.Form.Filter = "EmpSid = " & Me.txtEmpSId
Me!sfrmholder.Form!sfrm11.Form.FilterOn = True
Me!sfrmholder.Form!sfrm11.Form.Requery
it works perfectly well if i display only one subform. but the subforms
change one by one as in a control wizard in access. so, my idea is to find
the name of the subform in a select case statement and depending of the
present subform i want to take action accordingly. it is something like
Private Sub Form_Current()
Select Case Me!sfrmholder.Form.Name
Case sfrmOldIncrements
Me!sfrmholder.Form!sfrm2.Form.Filter = "EmpSid = " & Me.txtEmpSId
Me!sfrmholder.Form!sfrm2.Form.FilterOn = True
Me!sfrmholder.Form!sfrm2.Form.Requery
case XXX
Me!sfrmholder.Form!sfrm2.Form.Filter = "EmpSid = " & Me.txtEmpSId
Me!sfrmholder.Form!sfrm2.Form.FilterOn = True
Me!sfrmholder.Form!sfrm2.Form.Requery
End Select
End Sub
But this is not working.can any one tell me how to do this? If i get the
name of the subform, i can continue with the above code. I am quite hopeful
of a solution!!!! please tell me how to solve this
I have a problem with finding the name of the present subform in the main
form. Before coming to the problem,let me give a background of the design
Actually every first level subform is unbound and they hold one or two
second level subforms which are bound to tables and are in one- to- many
relation with the mainform. And every level1 subform has two navigation
buttons ".Next > ", "< Back ". the code in the click event of these buttons
see what form follows next. The code is as follows.
Me.Parent.sfrmholder.SourceObject = "sfrm to come next" etc...
Now i want the second level forms to display records related to the record
in the main form. the code is i used in the current event of the main form is:
Me!sfrmholder.Form!sfrm11.Form.Filter = "EmpSid = " & Me.txtEmpSId
Me!sfrmholder.Form!sfrm11.Form.FilterOn = True
Me!sfrmholder.Form!sfrm11.Form.Requery
it works perfectly well if i display only one subform. but the subforms
change one by one as in a control wizard in access. so, my idea is to find
the name of the subform in a select case statement and depending of the
present subform i want to take action accordingly. it is something like
Private Sub Form_Current()
Select Case Me!sfrmholder.Form.Name
Case sfrmOldIncrements
Me!sfrmholder.Form!sfrm2.Form.Filter = "EmpSid = " & Me.txtEmpSId
Me!sfrmholder.Form!sfrm2.Form.FilterOn = True
Me!sfrmholder.Form!sfrm2.Form.Requery
case XXX
Me!sfrmholder.Form!sfrm2.Form.Filter = "EmpSid = " & Me.txtEmpSId
Me!sfrmholder.Form!sfrm2.Form.FilterOn = True
Me!sfrmholder.Form!sfrm2.Form.Requery
End Select
End Sub
But this is not working.can any one tell me how to do this? If i get the
name of the subform, i can continue with the above code. I am quite hopeful
of a solution!!!! please tell me how to solve this