KEYASCII EN ADO(select)
Publicado por CATITA ZARATE (1 intervención) el 18/02/2006 18:47:50
Hola necesito su ayuda :
Estoy ingresando un codigo en una caja de texto(txt_cod) y al hacer enter deberia buscar el codigo en la TABLA(ACCESS) : CLIENTE_RECEPTOR y si lo encuentra lo desplegara en las cajas de texto txt_razon y txt_rut y el focus se ubicara en txt_pag
De lo contrario activara otro formulario donde se ingresara los datos del cliente, pero esto no sucede y me manda un mensaje de error:
“Error ‘3705’ en tiempo de ejecución:” la operación no esta permitida si el objeto esta abierto.
La sombra amarilla me indica que el error podria estar ubicado entre rstabla.open y adCmdText
LA TABLA DE LA BASE DE DATO:
*CLIENTE_RECEPTOR:
_codigo(key)
_rut
_descripcion
_codigo_comu
_telefono
_direccion
REFERENCIAS:
Microsoft ActiveX Data Objects 2.5 Library
NOTA: este proggrama me funciona bien en DAO
Private Sub txt_cod_keypress(keyascii As Integer)
C$ = Chr(keyascii)
If (C$ < "0" Or C$ > "9") And (keyascii <> 8) _
And (keyascii <> 13) Then
MsgBox "INGRESE NUMEROS "
keyascii = 0
Else
If keyascii = 13 And Trim(txt_cod) <> "" Then
rstabla.Open " select codigo, descripcion, rut " _
& " from cliente_receptor where codigo = " & txt_cod & " " _
, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If Not (rstabla.BOF Or rstabla.EOF) Then
rstabla.MoveFirst
Do While Not rstabla.EOF
txt_razon = rstabla!descripcion
txt_rut = rstabla!rut
txt_pag.SetFocus
rstabla.MoveNext
Loop
Else
MsgBox "INGRESE CLIENTE NUEVO"
txt_rut.SetFocus
Form2.Show
End If
rstabla.Close
End If
End If
End Sub
GENERAL DECLARACIONES
Public cnn As Connection
Public rstabla As Recordset
Private Sub Form_Load()
Set cnn = New Connection
Set rstabla = New Recordset
With cnn
.Provider = "microsoft.jet.oledb.4.0"
.ConnectionString = "c:\lacteos.mdb"
.Open
End UIT
End Sub
Espero su ayuda , detallelo por favor
CATITA ZARATE
Gracias.. chaooo…..
Estoy ingresando un codigo en una caja de texto(txt_cod) y al hacer enter deberia buscar el codigo en la TABLA(ACCESS) : CLIENTE_RECEPTOR y si lo encuentra lo desplegara en las cajas de texto txt_razon y txt_rut y el focus se ubicara en txt_pag
De lo contrario activara otro formulario donde se ingresara los datos del cliente, pero esto no sucede y me manda un mensaje de error:
“Error ‘3705’ en tiempo de ejecución:” la operación no esta permitida si el objeto esta abierto.
La sombra amarilla me indica que el error podria estar ubicado entre rstabla.open y adCmdText
LA TABLA DE LA BASE DE DATO:
*CLIENTE_RECEPTOR:
_codigo(key)
_rut
_descripcion
_codigo_comu
_telefono
_direccion
REFERENCIAS:
Microsoft ActiveX Data Objects 2.5 Library
NOTA: este proggrama me funciona bien en DAO
Private Sub txt_cod_keypress(keyascii As Integer)
C$ = Chr(keyascii)
If (C$ < "0" Or C$ > "9") And (keyascii <> 8) _
And (keyascii <> 13) Then
MsgBox "INGRESE NUMEROS "
keyascii = 0
Else
If keyascii = 13 And Trim(txt_cod) <> "" Then
rstabla.Open " select codigo, descripcion, rut " _
& " from cliente_receptor where codigo = " & txt_cod & " " _
, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If Not (rstabla.BOF Or rstabla.EOF) Then
rstabla.MoveFirst
Do While Not rstabla.EOF
txt_razon = rstabla!descripcion
txt_rut = rstabla!rut
txt_pag.SetFocus
rstabla.MoveNext
Loop
Else
MsgBox "INGRESE CLIENTE NUEVO"
txt_rut.SetFocus
Form2.Show
End If
rstabla.Close
End If
End If
End Sub
GENERAL DECLARACIONES
Public cnn As Connection
Public rstabla As Recordset
Private Sub Form_Load()
Set cnn = New Connection
Set rstabla = New Recordset
With cnn
.Provider = "microsoft.jet.oledb.4.0"
.ConnectionString = "c:\lacteos.mdb"
.Open
End UIT
End Sub
Espero su ayuda , detallelo por favor
CATITA ZARATE
Gracias.. chaooo…..
Valora esta pregunta


0