Quote:
Originally Posted by Aric Green
Thanks jaxjagfan that worked like a charm. I also need to update a date issued to employee field with the current date. I have tryed a couple things and am stuck on this as well because I am fairly new to coding. Here is what I have.
=======
Dim ctl As Control, varselected As Variant, strEmp As String, strWhere As String, strSql As String, strSql2 As String
strEmp = Me.cmb11
Set ctl = Me!List9
strSql = "Update tblCardstockAccountability SET strClerkCardIssuedTo ='" & strEmp & "'"
For Each varselected In ctl.ItemsSelected
strSql2 = "Update tblCardstockAccountability SET [DATE ISSUED TO CLERK] = '" & Date & "'"
strWhere = " Where [CARD NUMBER] = " & "'" & ctl.ItemData(varselected) & "'"
DoCmd.RunSQL strSql & strSql2 & strWhere
Next varselected
=======
Thanks,
Aric
strSql = "Update tblCardstockAccountability SET strClerkCardIssuedTo ='" & strEmp & "', [DATE ISSUED TO CLERK]=#" & Date() & "#"
For Each varselected In ctl.ItemsSelected
strWhere = " Where [CARD NUMBER] = " & "'" & ctl.ItemData(varselected) & "'"
DoCmd.RunSQL strSql & strWhere
Next varselected
It should look similar to the above. Get rid of strSQL2. What you are basically trying to tell it to do is - UPDATE tablename SET Column1 = Value1, Column2 = Value2 Where Column3 = Value3. You may have to change the "#" to a "'" depending on field types in your table.