Danny,
From my files. See below my SIG line ---
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com www.pcdatasheet.com
Use Values From A Multiselect Listbox As Query Criteria
Loop through the ItemsSelected collection of the listbox and generate the SQL
string.
Dim SQLStr As String
Dim vSel As Variant
SQLStr = "SELECT <some fields> FROM <some tables> WHERE <criteria>"
With Me!ListBoxName
If .ItemsSelected.Count > 0 Then ' Did user select any rows?
SQLStr = SQLStr & " AND [ClassID] IN("
For Each vSel In .ItemsSelected
SQLStr = SQLStr & .Column(0, varItem) & ", "
Next vSel
SQLStr = Left(SQLStr, Len(SQLStr) - 2) & ");"
End If
End With
Note: The first (zeroth actually) column of the listbox is assumed to be a long
integer ClassID.
SQLStr can now be used as the RecordSource
"Danny" <da********@hotmail.com> wrote in message
news:TK**********************@news4.srv.hcvlny.cv. net...
I set this up so the users can select more than one record so they can
update records a bunch at a time.
only one field is modified.
How can I edit this table easily instead of scrolling through the database
and comparing the selected items in the list box and comapring them to the
fields in the database.
Can you pass a list to an update query?
or can I edit one field in the database if I know the record number or that
ID number without having to loop through each one.
Thanks in advance