#1 Consulta sencilla en VB
65
MENSAJES
1,393
MENSAJES
#12 Re: Consulta sencilla en VB
rs.Open StrSql, cn, adOpenDynamic, adLockOptimistic
If InStr(Cade, Right(Me.txtOpcion, 1)) <> 0 Then
Form1.Text1.text = "Hola"
Me.Text1.text = "Hola".
Private Sub Command1_Click()
Unload Me
End Sub Private Sub Command1_Click()
Unload Form1
End Sub Private Sub Command1_Click()
Form2.Show
Form2.Text.Text1 = "GOL"
End Sub Call OptDatos 3
Private Function CargarGrilla(Index As Integer)
Private Sub Command1_Click()
CargarGrilla 1
End Sub Private Sub Command2_Click()
Dim i As Byte
For i = 1 To OptDatos.Count
If OptDatos = True Then CargarGrilla i
Next i
End Sub 
65
MENSAJES
#13 Re: Consulta sencilla en VB
65
MENSAJES
#14 Re: Consulta sencilla en VB
rs.Open StrSql, cn, adOpenDynamic, adLockOptimistic
1,393
MENSAJES
#15 Re: Consulta sencilla en VB
Private Function CargarGrilla(Index As Integer)
Dim Cade As String
Cade = "1234567890"
Select Case Index
Case 0
If txtOpcion = Empty Then
StrSql = "Select id, Nombre, Apellido, Telefono, Direccion, FechadeAlta from Personas"
Else
If Not IsNumeric(Me.txtOpcion) Then
StrSql = "Select id, Nombre, Apellido, Telefono,Direccion, FechadeAlta from Personas" & Me.txtOpcion.Text
Else
MsgBox "El codigo de cliente solo puede ser numérico", vbInformation, "sistemas"
txtOpcion = Empty
txtOpcion.SetFocus
End If
End If
Case 1
If txtOpcion = Empty Then
StrSql = "Select id, Nombre, Apellido, Telefono, Direccion, FechadeAlta from Personas"
Else
StrSql = "Select id, Nombre, Apellido, Telefono, Direccion, FechadeAlta from personas where apellido like '%" & txtOpcion.Text & "%'"
End If
Case 2
'StrSql = "Select id, Nombre, Apellido, Telefono, Direccion, FechadeAlta from personas where fechahora like '" & Fecha & "%'"
StrSql = "Select id, Nombre, Apellido, Telefono, Direccion, FechadeAlta from personas where Nombre='" & Nombre.Text & "'"
Case 3
StrSql = "Select id, Nombre, Apellido, Telefono, Direccion, FechadeAlta from personas where Telefono ='" & txtOpcion.Text & "'"
End Select
rs.Open StrSql, cn, adOpenDynamic, adLockOptimistic
Dim grilla As MSFlexGrid '<----- Agregado
Set grilla = MSFlexGrid1 '<------ Agregado
grilla.Clear
grilla.Rows = 1
grilla.FormatString = "ID | Nombre |Apellido | Teléfono | Direccion "
Do While Not rs.EOF
grilla.AddItem rs!id & vbTab & rs!Nombre & vbTab & rs!Apellido & vbTab & rs!Telefono & vbTab & rs!Direccion
rs.MoveNext
Loop
rs.Close
End Function Private Sub Form_Activate() CargarGrilla 1 End Sub
Private Function MostrarTexto(Texto As Integer, Sexo As String )
Select Case Texto
Case 1
If Sexo = "Masculino" Then
MsgBox "Bienvenido Señor"
Else
MsgBox "Bienvenido Señora"
End If
Case 2
If Sexo = "Masculino" Then
MsgBox "Disculpe Señor, no puso bien los datos"
Else
MsgBox "Disculpe Señora, no puso bien los datos"
End If
End Select
End Function Private Sub Form_Activate() MostrarTexto 1, "Masculino" 'o si no .... MostrarTexto 1, "Femenino" 'o si no .... MostrarTexto 2, "Masculino" 'o si no .... MostrarTexto 2, "Femenino" End Sub
ElseIf Sexo = "Femenino" Then
65
MENSAJES
#16 Re: Consulta sencilla en VB
Dim grilla As MSFlexGrid
Set grilla = MSFlexGrid1
Set Grilla = MSFlexGrilla
Dim Grilla As MSFlexGrid
1,393
MENSAJES
#17 Re: Consulta sencilla en VB
1,393
MENSAJES
#19 Re: Consulta sencilla en VB

65
MENSAJES
#20 Re: Consulta sencilla en VB