Geir Baardsen wrote:
Hi!
On frmItems I have a two listboxes. The first, lstAllCategories, is
loaded with data from tblCategory when frmItems open. When user click
lstAllCategories, the lstSelectedItems will show all records for that
category.
Now when user clicks chosen item in lstSelectedItems, textboxes in
form will be filled and now user can edit the selected item.
By "textboxes will be filled", do you mean the form navigates to the
questioned record?
However, I also have an Inputbox where user can enter an ItemNumber
and fill textboxes likewise.
So what I want is that lstSelectedItems will lookup the actual record
given in the inputbox that will fill textboxes, either by ItemID or
ItemName.
I've searched the group and think I've read that it is impossible to
have the cursor move and actually select the chosen record in the
textboxes.
To find a record matching an entered value (air code, A97)
dim rs as recordset
set rs=me.recordsetclone
rs.findfirst "yourkeyfield=" & thatinputbox ' if it is a numerical value
'rs.findfirst "yourkeyfield='" & thatinputbox & "'" ' if it is a text
if rs.nomatch then
msgbox "That value doesn't occur in this table"
else
me.bookmark=rs.bookmark
endif
set rs=nothing
To navigate to a selected item in a listbox (must not be multiselect!),
you can do much the same; or, if the form happens to be based on the
same source as the listbox (you can ensure that with
me.recordsource=listbox.rowsource):
docmd.gotorecord , , acGoto,listboxname.listindex + 1
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea