Access - problemas con sql statement y recordset

 
Vista:
sin imagen de perfil

problemas con sql statement y recordset

Publicado por Leonard (15 intervenciones) el 14/01/2011 17:08:00
Buenas a todos:

tengo problema con el siguiente select

sqlstr = "SELECT Tbl_Action_Record_Pending.CIF_Number, Tbl_Action_Record_Pending.Actions, Tbl_Action_Record_Pending.Date_Action, Tbl_Action_Record_Pending.Time_Action, Tbl_Action_Record_Pending.Officer_Code, Tbl_Action_Record_Pending.Date_Promised, Tbl_Action_Record_Pending.Time_Promised, Tbl_Action_Record_Pending.Payment_Amount, Tbl_Action_Record_Pending.Comments, Tbl_Action_Record_Pending.Windows_User FROM Tbl_Action_Record_Pending WHERE Tbl_Action_Record_Pending.Officer_Code = " & Pregunta & ";"

Este al aplicarlo en el recordset me da un error "Data type mismatch in criteria expression"

esto me tiene trancado "como cosa rara" :(

si alguien me puede indicar en que estoy fallando.

se le agredece de antemano

Leonard
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:problemas con sql statement y recordset

Publicado por jfableon (7 intervenciones) el 15/01/2011 01:55:35
Hola Leonard,

Es muy probable que el campo Officer_Code sea de texto y no un número, por tanto al crear la consulta se deben colocar comillas sencillas antes y después de Pregunta:

sqlstr = "SELECT Tbl_Action_Record_Pending.CIF_Number, Tbl_Action_Record_Pending.Actions, Tbl_Action_Record_Pending.Date_Action, Tbl_Action_Record_Pending.Time_Action, Tbl_Action_Record_Pending.Officer_Code, Tbl_Action_Record_Pending.Date_Promised, Tbl_Action_Record_Pending.Time_Promised, Tbl_Action_Record_Pending.Payment_Amount, Tbl_Action_Record_Pending.Comments, Tbl_Action_Record_Pending.Windows_User FROM Tbl_Action_Record_Pending WHERE Tbl_Action_Record_Pending.Officer_Code = '" & Pregunta & "';"

A simple vista no se notan pero ahí están: ' " & Pregunta & " '

Espero te sirva
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar