¿Cómo vincular mi folio con el nombre?
Necesito de favor vincular un textbox con mi base de datos que al insertar
el folio en un textbox en otro aparezca el nombre del articulo
mi base de datos tiene estos campos
folio Nombre
123 Pedro
Que al escribir 123 automáticamente me ponga el nombre en otro textbox o en
un label
uso ado y no uso data
por favor me urge
se muy explicito por que soy muy muy principiante
gracias
Mi código
Public rs As New ADODB.Recordset
Private Sub Form_Load()
Medico
cedula
laboratorio
antibióticos
Set GrillaBus.DataSource = RsAntibioticos
With RsMedico
Do Until .EOF
comboMed.AddItem .Fields(0)
.MoveNext
Loop
End With
With RsCedula
Do Until .EOF
comboCed.AddItem .Fields(0)
.MoveNext
Loop
End With
With RsLaboratorio
Do Until .EOF
comboLab.AddItem .Fields(0)
.MoveNext
Loop
End With
End Sub
Private Sub Command1_Click()
With RsAntibioticos
.Requery
.AddNew
!Folio = txtFolio.Text
!Nombre = txtNombre.Text
!Cantidad = txtCantidad.Text
!laboratorio = comboLab.Text
!medico = comboMed.Text
!cedula = comboCed.Text
!Retiene = txtRetiene.Text
.Update
.Requery
Limpiar
End With
End Sub
Private Sub cmdMedico_Click()
With RsMedico
.Requery
.AddNew
!Nombre = txtMed.Text
.Update
.Requery
End With
End Sub
Private Sub cmdCedula_Click()
With RsCedula
.Requery
.AddNew
!cedula = txtCed.Text
.Update
.Requery
End With
End Sub
Private Sub cmdLaboratorio_Click()
With RsLaboratorio
.Requery
.AddNew
!laboratorio = txtLab.Text
.Update
.Requery
End With
End Sub
Private Sub comboMed_Click()
If comboMed.Text = "Viridiana" Then
comboCed.Text = "01234567"
End If
End Sub
Private Sub comboOp_Click()
Dim X As Integer
X = 1
If comboOp.Text = "Si" Then
txtRetiene.Text = X
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Val(txtFolio.Text) = 1 Then
txtNombre.Text = "Acido"
End If
If Val(txtFolio.Text) = 2 Then
txtNombre.Text = "Acido2"
End If
If Val(txtFolio.Text) = 3 Then
txtNombre.Text = "Acido3"
End If
End Sub
Sub Limpiar()
txtFolio.Text = ""
txtNombre.Text = ""
txtCantidad.Text = ""
comboLab.Text = ""
comboMed.Text = ""
comboCed.Text = ""
txtRetiene.Text = ""
txtFolio.SetFocus
End Sub
'Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
' Dim cBuscar As String
' Dim cbuscar2 As String
' cbuscar2 = Text2.Text
' If KeyCode = 13 Then
' If Text1.Text = "" Then Exit Sub
' cBuscar = "Nombre like '" & Text1.Text & "*'"
' RsAntibioticos.MoveFirst
' RsAntibioticos.Find (cBuscar)
'
' If RsAntibioticos.EOF Then
' MsgBox ("No se encuentra este dato.")
'
' End If
'End If
'End Sub
Public rs As New ADODB.Recordset
Private Sub Form_Load()medicocedulalaboratorioantibioticosSet GrillaBus.DataSource = RsAntibioticosWith RsMedico Do Until .EOF comboMed.AddItem .Fields(0) .MoveNext LoopEnd WithWith RsCedula Do Until .EOF comboCed.AddItem .Fields(0) .MoveNext LoopEnd WithWith RsLaboratorio Do Until .EOF comboLab.AddItem .Fields(0) .MoveNext LoopEnd WithEnd SubPrivate Sub Command1_Click()
With RsAntibioticos .Requery .AddNew !Folio = txtFolio.Text !Nombre = txtNombre.Text !Cantidad = txtCantidad.Text !laboratorio = comboLab.Text !medico = comboMed.Text !cedula = comboCed.Text !Retiene = txtRetiene.Text .Update .Requery LimpiarEnd WithEnd SubPrivate Sub cmdMedico_Click()With RsMedico .Requery .AddNew !Nombre = txtMed.Text .Update .RequeryEnd WithEnd SubPrivate Sub cmdCedula_Click()With RsCedula .Requery .AddNew !cedula = txtCed.Text .Update .RequeryEnd WithEnd Sub
Private Sub cmdLaboratorio_Click()With RsLaboratorio .Requery .AddNew !laboratorio = txtLab.Text .Update .RequeryEnd WithEnd Sub
Private Sub comboMed_Click()If comboMed.Text = "Viridiana" Then comboCed.Text = "01234567"End IfEnd Sub
Private Sub comboOp_Click()Dim X As IntegerX = 1If comboOp.Text = "Si" Then txtRetiene.Text = XEnd IfEnd Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If Val(txtFolio.Text) = 1 ThentxtNombre.Text = "Acido"End IfIf Val(txtFolio.Text) = 2 ThentxtNombre.Text = "Acido2"End IfIf Val(txtFolio.Text) = 3 ThentxtNombre.Text = "Acido3"End IfEnd Sub
Sub Limpiar()txtFolio.Text = ""txtNombre.Text = ""txtCantidad.Text = ""comboLab.Text = ""comboMed.Text = ""comboCed.Text = ""txtRetiene.Text = ""txtFolio.SetFocusEnd Sub
'Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)' Dim cBuscar As String ' Dim cbuscar2 As String ' cbuscar2 = Text2.Text ' If KeyCode = 13 Then ' If Text1.Text = "" Then Exit Sub ' cBuscar = "Nombre like '" & Text1.Text &...
el folio en un textbox en otro aparezca el nombre del articulo
mi base de datos tiene estos campos
folio Nombre
123 Pedro
Que al escribir 123 automáticamente me ponga el nombre en otro textbox o en
un label
uso ado y no uso data
por favor me urge
se muy explicito por que soy muy muy principiante
gracias
Mi código
Public rs As New ADODB.Recordset
Private Sub Form_Load()
Medico
cedula
laboratorio
antibióticos
Set GrillaBus.DataSource = RsAntibioticos
With RsMedico
Do Until .EOF
comboMed.AddItem .Fields(0)
.MoveNext
Loop
End With
With RsCedula
Do Until .EOF
comboCed.AddItem .Fields(0)
.MoveNext
Loop
End With
With RsLaboratorio
Do Until .EOF
comboLab.AddItem .Fields(0)
.MoveNext
Loop
End With
End Sub
Private Sub Command1_Click()
With RsAntibioticos
.Requery
.AddNew
!Folio = txtFolio.Text
!Nombre = txtNombre.Text
!Cantidad = txtCantidad.Text
!laboratorio = comboLab.Text
!medico = comboMed.Text
!cedula = comboCed.Text
!Retiene = txtRetiene.Text
.Update
.Requery
Limpiar
End With
End Sub
Private Sub cmdMedico_Click()
With RsMedico
.Requery
.AddNew
!Nombre = txtMed.Text
.Update
.Requery
End With
End Sub
Private Sub cmdCedula_Click()
With RsCedula
.Requery
.AddNew
!cedula = txtCed.Text
.Update
.Requery
End With
End Sub
Private Sub cmdLaboratorio_Click()
With RsLaboratorio
.Requery
.AddNew
!laboratorio = txtLab.Text
.Update
.Requery
End With
End Sub
Private Sub comboMed_Click()
If comboMed.Text = "Viridiana" Then
comboCed.Text = "01234567"
End If
End Sub
Private Sub comboOp_Click()
Dim X As Integer
X = 1
If comboOp.Text = "Si" Then
txtRetiene.Text = X
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Val(txtFolio.Text) = 1 Then
txtNombre.Text = "Acido"
End If
If Val(txtFolio.Text) = 2 Then
txtNombre.Text = "Acido2"
End If
If Val(txtFolio.Text) = 3 Then
txtNombre.Text = "Acido3"
End If
End Sub
Sub Limpiar()
txtFolio.Text = ""
txtNombre.Text = ""
txtCantidad.Text = ""
comboLab.Text = ""
comboMed.Text = ""
comboCed.Text = ""
txtRetiene.Text = ""
txtFolio.SetFocus
End Sub
'Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
' Dim cBuscar As String
' Dim cbuscar2 As String
' cbuscar2 = Text2.Text
' If KeyCode = 13 Then
' If Text1.Text = "" Then Exit Sub
' cBuscar = "Nombre like '" & Text1.Text & "*'"
' RsAntibioticos.MoveFirst
' RsAntibioticos.Find (cBuscar)
'
' If RsAntibioticos.EOF Then
' MsgBox ("No se encuentra este dato.")
'
' End If
'End If
'End Sub
Public rs As New ADODB.Recordset
Private Sub Form_Load()medicocedulalaboratorioantibioticosSet GrillaBus.DataSource = RsAntibioticosWith RsMedico Do Until .EOF comboMed.AddItem .Fields(0) .MoveNext LoopEnd WithWith RsCedula Do Until .EOF comboCed.AddItem .Fields(0) .MoveNext LoopEnd WithWith RsLaboratorio Do Until .EOF comboLab.AddItem .Fields(0) .MoveNext LoopEnd WithEnd SubPrivate Sub Command1_Click()
With RsAntibioticos .Requery .AddNew !Folio = txtFolio.Text !Nombre = txtNombre.Text !Cantidad = txtCantidad.Text !laboratorio = comboLab.Text !medico = comboMed.Text !cedula = comboCed.Text !Retiene = txtRetiene.Text .Update .Requery LimpiarEnd WithEnd SubPrivate Sub cmdMedico_Click()With RsMedico .Requery .AddNew !Nombre = txtMed.Text .Update .RequeryEnd WithEnd SubPrivate Sub cmdCedula_Click()With RsCedula .Requery .AddNew !cedula = txtCed.Text .Update .RequeryEnd WithEnd Sub
Private Sub cmdLaboratorio_Click()With RsLaboratorio .Requery .AddNew !laboratorio = txtLab.Text .Update .RequeryEnd WithEnd Sub
Private Sub comboMed_Click()If comboMed.Text = "Viridiana" Then comboCed.Text = "01234567"End IfEnd Sub
Private Sub comboOp_Click()Dim X As IntegerX = 1If comboOp.Text = "Si" Then txtRetiene.Text = XEnd IfEnd Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If Val(txtFolio.Text) = 1 ThentxtNombre.Text = "Acido"End IfIf Val(txtFolio.Text) = 2 ThentxtNombre.Text = "Acido2"End IfIf Val(txtFolio.Text) = 3 ThentxtNombre.Text = "Acido3"End IfEnd Sub
Sub Limpiar()txtFolio.Text = ""txtNombre.Text = ""txtCantidad.Text = ""comboLab.Text = ""comboMed.Text = ""comboCed.Text = ""txtRetiene.Text = ""txtFolio.SetFocusEnd Sub
'Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)' Dim cBuscar As String ' Dim cbuscar2 As String ' cbuscar2 = Text2.Text ' If KeyCode = 13 Then ' If Text1.Text = "" Then Exit Sub ' cBuscar = "Nombre like '" & Text1.Text &...
6 Respuestas
Respuesta de emperador20
1
Respuesta de Roberto Alvarado
1
Respuesta de carloscharly
1
Respuesta de Martin Sanchez
1
Respuesta de juanis2808
1
Respuesta de korak
1