I have tried to figure this out for myself, but am stumped. I have added some additional fields to this form (cboAssocType,ActiveDt,InactiveDt), and the additional code to update the cells in this form to the fields in the corresponding fields in the table, but keep getting an error with the ActiveDt field. I know what this is somehow tied to the ShfitHrs field, but cannot seem to fix it.
Private Sub cmdAction_Click()
If Not IsNull(Me.txtOperator) Then
Select Case Me.cmdAction.Caption
Case “&Add”
If DCount(“username”, “tblAssociateList”, “username='” & Me.txtOperator & “‘”) > 0 Then
MsgBox “You have entered a duplicate operator”
Else
sSQL = “INSERT INTO tblAssociateList (username, manager, AssocType, shiftHrs, ActiveDt, InactiveDt) ” & _
“VALUES (‘” & Me.txtOperator & “‘, ‘” & Me.cboManager & “‘, ‘” & Me.cboAssocType & “‘, ‘” & Me.txtShiftHours & “‘, ‘” & Me.txtActvieDt & “)”
CurrentDb.Execute sSQL
Call cmdClear_Click
End If
Case “&Update”
sSQL = “UPDATE tblAssociateList ” & _
“SET username = ‘” & Me.txtOperator.Value & “‘, ” & _
“Manager='” & Me.cboManager.Value & “‘, ” & _
“AssocType='” & Me.cboAssocType.Value & “‘, ” & _
“ShiftHrs='” & Me.txtShiftHours.Value & “‘ ” & _
“ActiveDt='” & Me.txtActvieDt.Value & “‘ ” & _
“WHERE username = ‘” & Me.lstOperators & “‘”
CurrentDb.Execute sSQL
Call cmdClear_Click
Me.cmdAction.Caption = “&Add”
End Select
Would someone take a look at this and tell me where my error is.
Thanks!