Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Inquiry Form

Status
Not open for further replies.

pdoug76

MIS
May 28, 2003
12
US
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
 
Is your table (read recordset) bound to a form?

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.

rollie@bwsys.net
 
is there anyway i can create an expression instead or i have to use vb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top