datagrid
Publicado por pepe (3 intervenciones) el 20/12/2006 16:44:28
Hola buenas quiero que cuando en una de las columnas del datagrid pulso intro quiero que me busque en una tabla un registro y automaticamente lo inserte en el otro campo. todo esto con el codigo siguiente lo hace bien, el problema es que tengo ke darle 2 veces al intro pa ke busque bien el campo enlazado
If DataGrid1.Col = 3 Then
If KeyAscii = 13 Then
If rsasPredLinCuen.State = adStateOpen Then
rsasPredLinCuen.Close
End If
rsasPredLinCuen.Open "select * from cuentas where Cuenta like '" & Trim(DataGrid1.Columns("Cuenta").Text) & "%'", cn, adOpenDynamic, adLockOptimistic
If rsasPredLinCuen.EOF Or rsasPredLinCuen.BOF Then
DataGrid1.Columns("Titulo Cuenta").Text = ""
Else
DataGrid1.Columns("Titulo Cuenta").Text = rsasPredLinCuen.Fields("Descripcion")
DataGrid1.Columns("Cuenta").Text = rsasPredLinCuen.Fields("Cuenta")
rsasien.Update
DataGrid1.SetFocus
End If
End If
haber si alguien me puede decir komo se hace pero dandole 1 vez al intro
If DataGrid1.Col = 3 Then
If KeyAscii = 13 Then
If rsasPredLinCuen.State = adStateOpen Then
rsasPredLinCuen.Close
End If
rsasPredLinCuen.Open "select * from cuentas where Cuenta like '" & Trim(DataGrid1.Columns("Cuenta").Text) & "%'", cn, adOpenDynamic, adLockOptimistic
If rsasPredLinCuen.EOF Or rsasPredLinCuen.BOF Then
DataGrid1.Columns("Titulo Cuenta").Text = ""
Else
DataGrid1.Columns("Titulo Cuenta").Text = rsasPredLinCuen.Fields("Descripcion")
DataGrid1.Columns("Cuenta").Text = rsasPredLinCuen.Fields("Cuenta")
rsasien.Update
DataGrid1.SetFocus
End If
End If
haber si alguien me puede decir komo se hace pero dandole 1 vez al intro
Valora esta pregunta


0