hello all.
this is my very first post o a forum, so please don't mind my lack of knowledge or my spelling mistakes.
i'm also a newbie in access development trying to wrap my head around vba.
i got stuck on this Run-time Error 5 "Invalid Procedure Call or Argument" for weeks.
i have a main form on which i have an object called box1 and some command buttons that changes the .sourceobject of box1 to some other additional forms, applying filters to them in most cases. the other two forms use a custom funtion called fLiveSearch to filter results in a listbox control and they both work well independently. but when i try to apply a filtre via vba from the main form, frmPersonal generates the above error.
debug mode highlights line 56 in the frmPersonal code, apparently doesn't like the me. reference in me.filteron, me.filter, me.txtSearch.value and so on... saying that the object is closed or does not exist. i've tryed to replace me. with form_frmPersonal and forms!frmPersonal, but i get some other errors. i'm guessing that the form set as sourceobject to the box1 control its not loaded therefore it cannot find the expression me.txtSearch.Value generating the invalid argument error. the error occurs only when i try to apply the filter via vba from the main form.
any idea on how i could get over it?
works on this form
doesn't on this one
this is my very first post o a forum, so please don't mind my lack of knowledge or my spelling mistakes.
i'm also a newbie in access development trying to wrap my head around vba.
i got stuck on this Run-time Error 5 "Invalid Procedure Call or Argument" for weeks.
i have a main form on which i have an object called box1 and some command buttons that changes the .sourceobject of box1 to some other additional forms, applying filters to them in most cases. the other two forms use a custom funtion called fLiveSearch to filter results in a listbox control and they both work well independently. but when i try to apply a filtre via vba from the main form, frmPersonal generates the above error.
debug mode highlights line 56 in the frmPersonal code, apparently doesn't like the me. reference in me.filteron, me.filter, me.txtSearch.value and so on... saying that the object is closed or does not exist. i've tryed to replace me. with form_frmPersonal and forms!frmPersonal, but i get some other errors. i'm guessing that the form set as sourceobject to the box1 control its not loaded therefore it cannot find the expression me.txtSearch.Value generating the invalid argument error. the error occurs only when i try to apply the filter via vba from the main form.
any idea on how i could get over it?
works on this form
Private Sub btnCursuriCatb_Click()
Me.Box1.SourceObject = "frmcursuri"
Me.Box1.Form.Filter = "tblCatCurs_ID=2"
Me.Box1.Form.FilterOn = True
Me.Box1.SetFocus
Me.Box1.Form.Requery
End Sub
doesn't on this one
Private Sub btnPersRES_Click()
Me.Box1.SourceObject = "frmPersonal"
Me.Box1.Form.Filter = "tblSubunitate_ID=1"
Me.Box1.Form.FilterOn = True
Me.Box1.SetFocus
Me.Box1.Form.Requery
End Sub
[ICODE]