good day !
need your kind assistance for following.
i have a form and subform. need to do some filtering while form is loaidng. for that i put following code in main for "on load" event.
Private Sub Form_Load()
Dim disCon As String
disCon = "Select * from tbl_Impts_main where ((disConfirm) = 0 )"
Me.disconSub.Form.RecordSource = disCon
Me.disconSub.Form.Requery
End Sub
that works fine.
after load above i need to do one more filtering by using a combo box selection which is in the form header of the main form. for that i put below mentioned code. but while executing below given run time error pop ups.
Private Sub Combo4_AfterUpdate()
Dim Voy As String
Voy = "Select * from tbl_Impts_main where ((Voyage) = '" & Me.Combo4 & "')"
DoCmd.ApplyFilter Voy
Me.disconSub.Form.Requery
End Sub
Run time error '2491'
The action or method is invalid because the form or report isn't bound to a table or query.
when click on debug, docmd.applyfilter voyage highlighted in yellow.
Which mistake i have made ?
can i do this both filtering by using VBA and form/subforms ?
need your kind assistance for following.
i have a form and subform. need to do some filtering while form is loaidng. for that i put following code in main for "on load" event.
Private Sub Form_Load()
Dim disCon As String
disCon = "Select * from tbl_Impts_main where ((disConfirm) = 0 )"
Me.disconSub.Form.RecordSource = disCon
Me.disconSub.Form.Requery
End Sub
that works fine.
after load above i need to do one more filtering by using a combo box selection which is in the form header of the main form. for that i put below mentioned code. but while executing below given run time error pop ups.
Private Sub Combo4_AfterUpdate()
Dim Voy As String
Voy = "Select * from tbl_Impts_main where ((Voyage) = '" & Me.Combo4 & "')"
DoCmd.ApplyFilter Voy
Me.disconSub.Form.Requery
End Sub
Run time error '2491'
The action or method is invalid because the form or report isn't bound to a table or query.
when click on debug, docmd.applyfilter voyage highlighted in yellow.
Which mistake i have made ?
can i do this both filtering by using VBA and form/subforms ?