>How can I move item(s) from a list box campare to my table?
>
>this code is in a command button.
>
>
>for i = 1 to thisform.list2.listCount
> go top
> locate for alltrim(categoryPick) == alltrim(thisform.list2.list(i))
> if !found()
> thisform.list2.removeItem(thisform.list2.listIndex)
> endif
>endfor
>
This should work, but you need to go backwards, i.e.
for i = thisform.list2.listCount to 1 step -1
because when you remove the nth list element, the list is shorter by one - then the n+1st element is what at the loop start was actually n+2nd. Going backwards gives the effect that anything you've deleted is behind you, you won't step over it again.
The simpler way would be to just base the listbox on a cursor derived from your table (even if just a single-field one), and repopulate the cursor in listbox's .requery(). That way you don't need any loops to match listbox with the table - you pull what you need from the table and tell the listbox to use it.