
19/04/2007, 10:32
|
| | Fecha de Ingreso: marzo-2007
Mensajes: 8
Antigüedad: 18 años, 1 mes Puntos: 0 | |
Validar un campo del text1.text con la base de datos y mostrar otro campo en un label Hola a todos.
Queria saber si alguien de buena fe me puede ayudar con una validacion que tengo que hacer, lo que pasa es que tengo UNA PANTALLA DONDE INGRESO EL NUMERO DE CELULAR Y UN LABEL DONDE DEBO MOSTRAR EL NOMBRE DE LA EMPRESA A CUAL PERTENECE EL NUMERO.
ESTE ES MI CODIGO Y EL ERROR QUE ME SALE , ME DICE QUE FALTA UN OBJETO... AYUDA PORFIS.....!!!!
Private Sub Command1_Click()
rcs2.Open "select * from Resultados where SUSCRIPTOR= '" & Text1.Text & "'", cnn
If rcs2.BOF = True Then
MsgBox ("El Número no Existe"), vbInformation, "Información"
Else
'aqui va el dato recuperado y en tu foto no muestras donde vas a mostrar los datos
'pero hagamoslo asi
With rcs
Label3 = .Fields(COMPANIA)
End With
' With rcs2
' MsgBox "El numero ingresado es del cliente:" & .COMPAÑÍA_TELEFÓNICA & " "
'End With
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Form_Load()
conectar
CentrarVentana Form1
End Sub
---------------------------------
MODULO
----------------------------------
Option Explicit
Public cnn As New ADODB.Connection
Public rcs As New ADODB.Recordset
Dim rcs2 As New ADODB.Recordset
Public Sub conectar()
Set cnn = Nothing
Set rcs = Nothing
Set cnn = New ADODB.Connection
Set rcs = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Validacion.mdb;Persist Security Info=False"
rcs.Open "select * from Resultados", cnn, adOpenDynamic, adLockOptimistic
End Sub
Public Sub CentrarVentana(Forma As Form)
'Centra la ventana en la pantalla
Forma.Move (Screen.Width - Forma.Width) / 2, _
(Screen.Height - Forma.Height) / 2
End Sub |