Hi All
So i have the following which works as a select query
My table consisits of 3 colums
TapeID this is what the multi selection is based on
TxtBxDate this is date
CaseId listbox (single selection)
what i need is the command button to update the txtbxdate, CaseID ased on the given variables in the listbox , textbox but only for the items selected in the TapeID multiselection list box.
How would i modify the above to do this? The above displays the multi selected tapeID listbox.
Thanks in advance for any help.
So i have the following which works as a select query
Code:
Private Sub Command4_Click()
Dim Q As QueryDef, DB As Database
Dim Criteria As String
Dim ctl As Control
Dim Itm As Variant
' Build a list of the selections.
Set ctl = Me![List0]
For Each Itm In ctl.ItemsSelected
If Len(Criteria) = 0 Then
Criteria = Chr(34) & ctl.ItemData(Itm) & Chr(34)
Else
Criteria = Criteria & "," & Chr(34) & ctl.ItemData(Itm) _
& Chr(34)
End If
Next Itm
If Len(Criteria) = 0 Then
Itm = MsgBox("You must select one or more items in the" & _
" list box!", 0, "No Selection Made")
Exit Sub
End If
' Modify the Query.
Set DB = CurrentDb()
Set Q = DB.QueryDefs("QryUpdateTapes")
Q.SQL = "SELECT * From TblTapes Where [TapeID] In(" & Criteria & _
");"
Q.Close
' Run the query.
DoCmd.OpenQuery "QryUpdateTapes"
End Sub
My table consisits of 3 colums
TapeID this is what the multi selection is based on
TxtBxDate this is date
CaseId listbox (single selection)
what i need is the command button to update the txtbxdate, CaseID ased on the given variables in the listbox , textbox but only for the items selected in the TapeID multiselection list box.
How would i modify the above to do this? The above displays the multi selected tapeID listbox.
Thanks in advance for any help.