Buenos dias gente tengo un problema en un Form
Quiero que al dar enter habra de la base de datos un cod existente, este es el cod que tengo
Private Sub Txtcodvendedor_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
sql = "Select * from vendedores where codvendedores = " '" & Txtcodvendedor & "'" Set rst = BD.OpenRecordset(sql) If rst.RecordCount = 1 Then Txtcodvendedor = rst!codvendedores Txtvendedor = rst!nombvendedores Else MsgBox "Registro no existe" If MsgBox("Desea Crear", vbYesNo + vbQuestion) = vbYes Then Frmvendedores.Show 1 Exit Sub End If Txtvendedor.SetFocus Exit Sub End If End If End Sub
Private Sub Txtcodvendedor_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
sql = "Select * from vendedores where codvendedores = " '" & Txtcodvendedor & "'" Set rst = BD.OpenRecordset(sql) If rst.RecordCount = 1 Then Txtcodvendedor = rst!codvendedores Txtvendedor = rst!nombvendedores Else MsgBox "Registro no existe" If MsgBox("Desea Crear", vbYesNo + vbQuestion) = vbYes Then Frmvendedores.Show 1 Exit Sub End If Txtvendedor.SetFocus Exit Sub End If End If End Sub