Hi everybody! I am having a strange problem, Im working with a remote access database, i have one application to introduce info to de database and other for making a query. The firt one works perfect...but in the second one the application jumps to the error code when tries to open the recordset. the function I am using is the following:
Private Function Leer_DatoSql(cadena_ejecucion As String) As Variant
'Ejecuta una cadena tipo Transact-SQL según la cadena de conexión
'CONEXION BASICA CON LA BASE DE DATOS acces
'FUNCION QUE SE LLAMA CADA VEZ QUE SE BUSCA UN DATO
'LOS REGISTROS QUE SE TOMAN DE LA BASE DE DATOS SE RETORNAN EN UN OBJETO
'RECORDSET
On Error GoTo error_leer_datosql
'CREACION DEL OBJETO RECORSET
Dim REC As New ADODB.Recordset
REC.CursorLocation = adUseClient
REC.LockType = adLockReadOnly
REC.CursorType = adOpenStatic
'CADENA LA CONEXION DE LA BASE DE DATOS PARA TIPO ACCESS
REC.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=Z:\softphone;" & _
"Uid=usuario;" & _
"Pwd=80234040;"
REC.Source = cadena_ejecucion
REC.Open
REC.ActiveConnection = Nothing
Set Leer_DatoSql = REC
Exit Function
error_leer_datosql:
Set Leer_DatoSql = Nothing
End Function
Please help me!!!