Hi, hope all are doing fine.. need some suggestions. I am using VB and Acccess and am trying to fetch a record from database by:
"Select * from accounts where emp_code='"+d+"' AND emp_name='"+n+"'"". The inputs are fetched from an Inputbox. but i get a compilation error...
Run-time error '13': Type mismatch
-- .. i am little confused here.
can anyone please correct the query or give an alternate way to fetch the record..? I am trying to delete a record basing on two inputs, ie the emp_code and emp_name.
thanks.

regards
chanthung

try this one

Select * from accounts where emp_code='" & str1 & "'  AND emp_name= '" & str2 & "', conn

the following query should work fine for you


"Select * from accounts where emp_code='"+d+"' AND emp_name='"+n+"'"

I am trying to delete a record basing on two inputs, ie the emp_code and emp_name.

Suppose your criteria comes from the textboxes (txtEmployeeCode & txtEmployeeName)... deleting a record will be..

If you are using a DAO Connection

"DELETE    *    FROM       Account     WHERE     EmpCode = '" & txtEmployeeCode.Text "'    AND   EmpName = '" & txtEmployeeName.Text  & "'  "

If you are using an ADO Connection (Ommit the *)

"DELETE    FROM       Account     WHERE     EmpCode = '" & txtEmployeeCode.Text "'    AND   EmpName = '" & txtEmployeeName.Text  & "'  "

Hope it would help.

hi guys,
took help from the code given by u all and it worked.
Many many thanks to you all.

Regards
chanthung

This question has already been answered. Start a new discussion instead.