Hello guys, i am facing problem while updating database. I get "data type mismatch in criteria expression" error when click update button.
*The database i am using is creadted ms office acess appliaction.
*I have created a module where i have putted connection data in a sub function named sub connect(), which works well while inserting records.
Here is the coding i use:
Private Sub Form_Load() Call connect End Sub Private Sub update_Click() Dim i As Integer i = InputBox("enter employee id to edit") rcd.Filter = "employeeid=" & Val(i) If rcd.RecordCount > 0 Then With cmd .CommandText = "update employee set employeeid =" & Val(Text1.Text) & "," & "name=" & "'" & Text2.Text & "'" & " " & " where employeeid=" & val(i) .CommandType = adCmdText .ActiveConnection = con .Execute End With Else MsgBox "record not found" End If rcd.Filter = adFilterNone rcd.Requery con.Close End Sub