vba - How to solve error 91 in access -
i encountered error when ran code on search button. below code. thank you.
option compare database option explicit private sub txtsearch_click() if isnull(searchbar) = false me.recordset.findfirst "[ponumber]=" & searchbar me!searchbar = null if me.recordset.nomatch msgbox "no record found", vbokonly + vbinformation, "sorry" me!searchbar = null end if end if end sub
you have keep recordset:
private sub txtsearch_click() dim rs dao.recordset if isnull(me!searchbar.value) = false set rs = me.recordsetclone rs.findfirst "[ponumber]=" & me!searchbar.value if rs.nomatch msgbox "no record found", vbokonly + vbinformation, "sorry" else me.bookmark = rs.bookmark end if me!searchbar.value = null end if set rs = nothing end sub
Comments
Post a Comment