I have a form in a database that I am trying to use a combo box to select an employee and then a listbox to select multiple card numbers to assign to the employee selected. When I push a button I want it to put the name of the employee in the table for all card numbers selected. Here is the following code that I am trying. I am not sure what is wrong. (Note: In the Immediate window "False" is what is displayed after I run the code and get the error
Run-time error '3078':
The Microsoft Jet database engine cannot find the input table or query 'False'. Make sure it exists and that its name is spelled correctly.
=======
[code=vb]
Private Sub ASSIGN_USER_TO_ CARDS_Click()
Dim db As Database
Dim rec As DAO.Recordset
Dim strWhere As String
Dim varSelected As Variant
Dim strSQL As String
Set db = CurrentDb()
Set rec = db.OpenRecordse t("tblCardstock Accountability" )
If Me!List9.ItemsS elected.Count > 0 Then
For Each varSelected In Me!List9.ItemsS elected
strWhere = strWhere & """" & Me!List9.ItemDa ta(varSelected) & """, "
Next varSelected
strSQL = ""
strSQL = strSQL & "UPDATE tblCardstockAcc ountability " & _
strSQL = strSQL & "SET strClerkCardIss uedTo = """ & Me.cmb11 & """"
strSQL = strSQL & " WHERE strClerkCardIss uedTo IN (" & strSQL = strSQL & Left$(strWhere, Len(strWhere) - 2) & ")"
Debug.Print strSQL
CurrentDb.Execu te strSQL
Set db = Nothing ' Clear db...
MsgBox ("This data is now in your table..")
End If
End Sub
[/code]
=======
Run-time error '3078':
The Microsoft Jet database engine cannot find the input table or query 'False'. Make sure it exists and that its name is spelled correctly.
=======
[code=vb]
Private Sub ASSIGN_USER_TO_ CARDS_Click()
Dim db As Database
Dim rec As DAO.Recordset
Dim strWhere As String
Dim varSelected As Variant
Dim strSQL As String
Set db = CurrentDb()
Set rec = db.OpenRecordse t("tblCardstock Accountability" )
If Me!List9.ItemsS elected.Count > 0 Then
For Each varSelected In Me!List9.ItemsS elected
strWhere = strWhere & """" & Me!List9.ItemDa ta(varSelected) & """, "
Next varSelected
strSQL = ""
strSQL = strSQL & "UPDATE tblCardstockAcc ountability " & _
strSQL = strSQL & "SET strClerkCardIss uedTo = """ & Me.cmb11 & """"
strSQL = strSQL & " WHERE strClerkCardIss uedTo IN (" & strSQL = strSQL & Left$(strWhere, Len(strWhere) - 2) & ")"
Debug.Print strSQL
CurrentDb.Execu te strSQL
Set db = Nothing ' Clear db...
MsgBox ("This data is now in your table..")
End If
End Sub
[/code]
=======
Comment