Hi, I created a form to look up records by item number. the table is setup as
itemNumber,Desc,Cost
I am not sure how to retrieve the record by entering the item number to pull up the description and the cost. Can someone help me.
Thanks
Paul
If so, and the ID is in a combobox or listbox or textbox then
Dim rs as dao.recordset
set rs = me.recordsetclone
rs.movefirst
do while not rs.eof
if rs("MyID" = me.MyID then
me.bookmark = rs.bookmark
exit do
endif
rs.movenext
loop
rs.close
set rs = nothing
exit sub
This will do what you wish. It brings a recordset like the one in the form into the workspace and loops thru till it finds the correct one and then sets the form's recordset to the clone's recordset, cleans up and gives you back control.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.