This topic is locked
[SOLVED]

 Dblookup Error 800A0Bb9

1/26/2013 4:35:55 PM
ASPRunnerPro General questions
S
solosoftware author

Hello group,
I am trying to use the DBLookup Function but is showing me the following MS Access Error:
The application is using arguments that are of the wrong type, or are out of acceptable range, or are in conflict with one another.
My programming loads the Value from Field CODIGO into the nCliente variable, this works fine:
if not IsBinaryType(pageObject.pSet.getFieldType_p1(dkeys(n))) then

nCliente=values(dkeys(n))

end if
I build my string:

cSQL = "SELECT CLIENTE FROM CLIENTES_SQL WHERE CODIGO = " & nCliente
Call the function:

cCliente = DBLookup(cSQL)
It should return the Field CLIENTE from CLIENTES_SQL, but instead it sends me the ADO Error

The Field CODIGO on the Table CLIENTES_SQL is a number.
Please let me know what am I doing wrong.

Sergey Kornilov admin 1/27/2013

If CODIGO is a text field you need to use the following:

cSQL = "SELECT CLIENTE FROM CLIENTES_SQL WHERE CODIGO = '" & nCliente & "'"
S
solosoftware author 1/28/2013

Hello Admin,
The field CODIGO is a number, so I left the Query without quotes.



If CODIGO is a text field you need to use the following:

cSQL = "SELECT CLIENTE FROM CLIENTES_SQL WHERE CODIGO = '" & nCliente & "'"


Sergey Kornilov admin 1/28/2013

If CODIGO is a numeric field make sure nCliente variable also contains a number.
You can also print SQL Query on the page instead of executing it.

cSQL = "SELECT CLIENTE FROM CLIENTES_SQL WHERE CODIGO = " & nCliente

Response.Write cSQL

Response.End
cCliente = DBLookup(cSQL)
S
solosoftware author 1/28/2013

Hello Admin,
Same error occurs. I even used CINT():

cSQL = "SELECT CLIENTE FROM CLIENTES_SQL WHERE CODIGO = " & CInt(nCliente)
Printed the cSQL string, that shows the correct query. the query runs OK on MSAccess:

SELECT CLIENTE FROM CLIENTES_SQL WHERE CODIGO = 14
However the same error:

ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/ordenesservicio/include/dal.asp, line 232

**
I am using this as an alternative, but the DBLookup function should be faster and cleaner:

'~~~~~~~~~

cSQL = "CODIGO = " & nCliente

set rs=dal.Table("CLIENTES_SQL")

set data=rs.Query(cSQL,"")

cCliente = data("CLIENTE")

'~~~~~~~~~