Adding multiple selections in List box to a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a list box that can select multiple rows. I need to get each row
added to table and do a index/search. I currently have the following code
(partial listed here):

For Each PartInList In Me.PartList.ItemsSelected
P.Index = "PartNumber"
P.Seek "=", Forms!frmcreatequote!PartList
If Not P.NoMatch Then
Q!part = P!partnumber
If P!GSA = 1 Then
Q!price = (P!unitPRICE * 0.75)
......
Next PartInList

My problem is that i can't do a 'search' using a column in the list box,
because the bound column is now null (due to multiple selections). How can I
add each row to the table and do a search for data on another table using the
row that is currently in use by the code??
 
How can I
add each row to the table and do a search for data on another table
using the row that is currently in use by the code??

I really don't understand what your code fragment was trying to do, since
none of it seems to access the loop control variable. Nevertheless, the
normal database way to look up single values is with DLookup:

Q!Price = DLookUp("UnitPrice", "SomeOtherTable",
"Partnumber = " & Me!PartList.Column(1, wPartInList))


I haven't used Index and Seek since dBase IV days in the last century (or
was it the one before..?)


All the best


Tim F
 
Thanks but no thanks.

I actually figured it out on my own. As for me using index/seek. I only use
VBA for a small part of my job and am relying on the information that I was
taught 6 years ago. It works and I know it.
 
Back
Top