Yo. I am making a project in vb6. The backend is MS Access 2003. Data is entered into the form and stored in the database table.
The code:
With cnct
.BeginTrans
.Execute "INSERT INTO Employee_Info (EI_CNIC, EI_FirstName, EI_LastName, EI_Gender, EI_Birthdate, EI_Country, EI_Language, EI_MaritalStat, EI_Education, EI_Designation, EI_Salary, EI_ResdAddress, EI_ResdContact, EI_Cellphone, EI_EmailID, EI_PostalCode, EI_FaxCode, EI_Supervisor, EI_DateHired)" & "VALUES('" & txtCNIC.Text & "', '" & txtFirstName.Text & "', '" & txtLastName.Text & "', '" & cboGender.Text & "', '" & lblBirthdate.Caption & "', '" & cboCountry.Text & "', '" & txtLanguage.Text & " ', '" & cboMaritalStatus.Text & "', '" & txtEducation.Text & "', '" & txtDesignation.Text & "', '" & txtSalary.Text & "', '" & txtResdAddress.Text & "', '" & txtResdContact.Text & "', '" & txtCellPhone.Text & "', '" & txtEmailID.Text & "', '" & txtPostalCode.Text & "', '" & txtFaxCode.Text & "', '" & txtSupervisor.Text & "', '" & txtDateHired.Text & "')"
.CommitTrans
End With
In the database table:
these fields are number data type: EI_CNIC, EI_ResdContact, EI_Cellphone, EI_PostalCode, EI_FaxCode.
the rest are text data type
I get a data type mismatch in criteria expression error. I researched a lot on the net and the most common solution offered is to remove the single inverted comma(') around the fields that are not string data types. It doesnt work in my case.
A bit of guidance would be great.