rhakz
asked on
Data type mismatch...
Hi,
I'm trying to open a Recordset using a SQL query, my code is like this:
rsSeg.Open "SELECT * FROM Seguimientos WHERE Fecha=#" & fecha & "# AND Hora=#" & hora & "# AND NoCliente='" & Val(lista((indice * 3) + 2)) & "'", DB, adOpenKeyset, adLockOptimistic
Both Fecha and Hora are date types.
Lista is a string array.
The thing is, I always get the "Data Type mismatch in criteria expression" error, even though I have tried several changes.
I'd be glad if u could help me.
Thanks in advance.
Rhakz
I'm trying to open a Recordset using a SQL query, my code is like this:
rsSeg.Open "SELECT * FROM Seguimientos WHERE Fecha=#" & fecha & "# AND Hora=#" & hora & "# AND NoCliente='" & Val(lista((indice * 3) + 2)) & "'", DB, adOpenKeyset, adLockOptimistic
Both Fecha and Hora are date types.
Lista is a string array.
The thing is, I always get the "Data Type mismatch in criteria expression" error, even though I have tried several changes.
I'd be glad if u could help me.
Thanks in advance.
Rhakz
What DBMS (Base de datos) and more specifically what provider are you using?
Anthony
Anthony
Does your table "Seguimientos" contain valid date values in the columns "Fecha" and "Hora"? I'm just wondering if it's a data related error rather than a VB one. Use MSAcess to have a "visual" look at the data first to see if anything looks unusual. Try sorting on these two columns to see what rises to the top.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi rhakz,
This old question (QID 20567621) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
This old question (QID 20567621) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
-->PAQ - with points refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER
GPrentice00
Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
-->PAQ - with points refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER
GPrentice00
Cleanup Volunteer
sSQL = "SELECT * FROM Seguimientos WHERE Fecha=#" & fecha & "# AND Hora=#" & hora & "# AND NoCliente='" & Val(lista((indice * 3) + 2)) & "'"
MsgBox(sSQL)
rsSeg.Open sSQL, DB, adOpenKeyset, adLockOptimistic
If you did not get an error message at the first statement; then from the messagebox you will come to see the query.
You can also use Clipoard.SetText sSQL to copy the query to the clipboard; and then paste it into SQL Query analyzer and see i their is something wrong with the query