Ayuda con este codigo de enlace de formularios ERROR de operador
saludos, estoy trabajando en una base de datos en donde enlazo 2 formularios pero al enlazar uno con otro si funciona pero a la hora de seleccionar en la bd de acces no se conecta. el codigo esta aqui
primer formulario "frmbusqueda"
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub List1_DblClick()
usr = List1.Text
Unload Me
Form1.Show
End Sub
Private Sub Command1_Click()
Dim r As New ADODB.Recordset
List1.Clear
If Text1.Text = "" Then
MsgBox "Ingrese Palabra clave"
Else
s = "select * From alumnos Where curp Like '" & UCase(Text1.Text) & "%'"
r.Open s, conectar, adOpenForwardOnly, adLockReadOnly, admdtext
Do While Not r.EOF
List1.AddItem r!curp
r.MoveNext
Loop
r.Close
End If
End Sub
'FIN DEL PRIMER FORMULARIO
'SEGUNDO FORMULARIO
Dim sxo As String
Private Sub Form_Load()
Dim r As New ADODB.Recordset
Dim s As String
'Text12.Text = usr
If usr <> "" Then
'AQUI MARCA EL ERROR ME DICE QUE FALTA OPERADOR
s = "select * from alumnos where curp =" & usr
r.Open s, conectar, adOpenForwardOnly, adLockReadOnly, admdtext
Text1.Text = p!apaterno
Text2.Text = p!amaterno
Text3.Text = p!nombre
Option1.Value = True
End If
If p!sexo = F Then
Option2.Value = True
End If
End Sub
Private Sub Command1_Click()
Dim r As New ADODB.Recordset
Dim s As String
s = "select * from alumnos"
r.Open s, conectar, adOpenKeyset, adLockOptimistic, adCmdText
r.AddNew
r!apaterno.Value = UCase(Trim(Text1.Text))
r!amaterno.Value = UCase(Trim(Text2.Text))
r!nombre.Value = UCase(Trim(Text3.Text))
r!sexo.Value = Trim(sxo)
r!fechanac.Value = UCase(Trim(Text4.Text))
r!curp.Value = UCase(Trim(Text5.Text))
r!grado.Value = UCase(Trim(Combo1.Text))
r!grupo.Value = UCase(Trim(Text6.Text))
r!turno.Value = UCase(Trim(Combo2.Text))
r!beca.Value = UCase(Trim(Combo3.Text))
r!tecnologia = UCase(Trim(Combo4.Text))
r!domicilio.Value = UCase(Trim(Text7.Text))
r!telefono.Value = UCase(Trim(Text8.Text))
r!municipio.Value = UCase(Trim(Text9.Text))
r!entidad.Value = UCase(Trim(Text10.Text))
r!tutor.Value = UCase(Trim(Text11.Text))
r!observaciones = UCase((Text12.Text))
r!enlace = UCase((Text5.Text)) & " " & UCase((Text1.Text)) & " " & UCase((Text2.Text)) & " " & UCase((Text3.Text))
r.Update
r.Close
limpiar
End Sub
Public Sub limpiar()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Dim r As New ADODB.Recordset
Dim s As String
s = "select * from alumnos where curp=" & Val(Text5.Text)
r.Open s, conectar, adOpenKeyset, adLockOptimistic, adCmdText
r!apaterno.Value = UCase(Trim(Text1.Text))
r!amaterno.Value = UCase(Trim(Text2.Text))
r!nombre.Value = UCase(Trim(Text3.Text))
r!sexo.Value = Trim(sxo)
r!fechanac.Value = UCase(Trim(Text4.Text))
r!curp.Value = UCase(Trim(Text5.Text))
r!grado.Value = UCase(Trim(Combo1.Text))
r!grupo.Value = UCase(Trim(Text6.Text))
r!turno.Value = UCase(Trim(Combo2.Text))
r!beca.Value = UCase(Trim(Combo3.Text))
r!tecnologia = UCase(Trim(Combo4.Text))
r!domicilio.Value = UCase(Trim(Text7.Text))
r!telefono.Value = UCase(Trim(Text8.Text))
r!municipio.Value = UCase(Trim(Text9.Text))
r!entidad.Value = UCase(Trim(Text10.Text))
r!tutor.Value = UCase(Trim(Text11.Text))
r!observaciones = UCase((Text12.Text))
r.Update
r.Close
limpia
End Sub
Private Sub Command3_Click()
Dim r As New ADODB.Recordset
Dim s As String
s = "select * from alumnos where curp=" & Text5.Text
r.Open s, conectar, adOpenKeyset, adLockOptimistic, adCmdText
r.Delete
r.Update
r.Close
limpia
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub option1_Click()
sxo = "M"
End Sub
Private Sub Option2_Click()
sxo = "F"
End Sub
'FIN DEL SEGUNDO FORMULARIO
'MODULO DE CONEXION
Public conectar As New ADODB.Connection
Public usr As String
Public Sub main()
conectar.CursorLocation = adUseClient
Dim path As String
path = App.path & "tamos.mdb"
conectar.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & path & ";"
conectar.Open
'Form1.Show
Form2.Show
End Sub
'FIN DEL MODULO
bueno ese es mi codigo soy principiante espero que alguien pueda ayudarme
GRACIAS
primer formulario "frmbusqueda"
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub List1_DblClick()
usr = List1.Text
Unload Me
Form1.Show
End Sub
Private Sub Command1_Click()
Dim r As New ADODB.Recordset
List1.Clear
If Text1.Text = "" Then
MsgBox "Ingrese Palabra clave"
Else
s = "select * From alumnos Where curp Like '" & UCase(Text1.Text) & "%'"
r.Open s, conectar, adOpenForwardOnly, adLockReadOnly, admdtext
Do While Not r.EOF
List1.AddItem r!curp
r.MoveNext
Loop
r.Close
End If
End Sub
'FIN DEL PRIMER FORMULARIO
'SEGUNDO FORMULARIO
Dim sxo As String
Private Sub Form_Load()
Dim r As New ADODB.Recordset
Dim s As String
'Text12.Text = usr
If usr <> "" Then
'AQUI MARCA EL ERROR ME DICE QUE FALTA OPERADOR
s = "select * from alumnos where curp =" & usr
r.Open s, conectar, adOpenForwardOnly, adLockReadOnly, admdtext
Text1.Text = p!apaterno
Text2.Text = p!amaterno
Text3.Text = p!nombre
Option1.Value = True
End If
If p!sexo = F Then
Option2.Value = True
End If
End Sub
Private Sub Command1_Click()
Dim r As New ADODB.Recordset
Dim s As String
s = "select * from alumnos"
r.Open s, conectar, adOpenKeyset, adLockOptimistic, adCmdText
r.AddNew
r!apaterno.Value = UCase(Trim(Text1.Text))
r!amaterno.Value = UCase(Trim(Text2.Text))
r!nombre.Value = UCase(Trim(Text3.Text))
r!sexo.Value = Trim(sxo)
r!fechanac.Value = UCase(Trim(Text4.Text))
r!curp.Value = UCase(Trim(Text5.Text))
r!grado.Value = UCase(Trim(Combo1.Text))
r!grupo.Value = UCase(Trim(Text6.Text))
r!turno.Value = UCase(Trim(Combo2.Text))
r!beca.Value = UCase(Trim(Combo3.Text))
r!tecnologia = UCase(Trim(Combo4.Text))
r!domicilio.Value = UCase(Trim(Text7.Text))
r!telefono.Value = UCase(Trim(Text8.Text))
r!municipio.Value = UCase(Trim(Text9.Text))
r!entidad.Value = UCase(Trim(Text10.Text))
r!tutor.Value = UCase(Trim(Text11.Text))
r!observaciones = UCase((Text12.Text))
r!enlace = UCase((Text5.Text)) & " " & UCase((Text1.Text)) & " " & UCase((Text2.Text)) & " " & UCase((Text3.Text))
r.Update
r.Close
limpiar
End Sub
Public Sub limpiar()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Dim r As New ADODB.Recordset
Dim s As String
s = "select * from alumnos where curp=" & Val(Text5.Text)
r.Open s, conectar, adOpenKeyset, adLockOptimistic, adCmdText
r!apaterno.Value = UCase(Trim(Text1.Text))
r!amaterno.Value = UCase(Trim(Text2.Text))
r!nombre.Value = UCase(Trim(Text3.Text))
r!sexo.Value = Trim(sxo)
r!fechanac.Value = UCase(Trim(Text4.Text))
r!curp.Value = UCase(Trim(Text5.Text))
r!grado.Value = UCase(Trim(Combo1.Text))
r!grupo.Value = UCase(Trim(Text6.Text))
r!turno.Value = UCase(Trim(Combo2.Text))
r!beca.Value = UCase(Trim(Combo3.Text))
r!tecnologia = UCase(Trim(Combo4.Text))
r!domicilio.Value = UCase(Trim(Text7.Text))
r!telefono.Value = UCase(Trim(Text8.Text))
r!municipio.Value = UCase(Trim(Text9.Text))
r!entidad.Value = UCase(Trim(Text10.Text))
r!tutor.Value = UCase(Trim(Text11.Text))
r!observaciones = UCase((Text12.Text))
r.Update
r.Close
limpia
End Sub
Private Sub Command3_Click()
Dim r As New ADODB.Recordset
Dim s As String
s = "select * from alumnos where curp=" & Text5.Text
r.Open s, conectar, adOpenKeyset, adLockOptimistic, adCmdText
r.Delete
r.Update
r.Close
limpia
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub option1_Click()
sxo = "M"
End Sub
Private Sub Option2_Click()
sxo = "F"
End Sub
'FIN DEL SEGUNDO FORMULARIO
'MODULO DE CONEXION
Public conectar As New ADODB.Connection
Public usr As String
Public Sub main()
conectar.CursorLocation = adUseClient
Dim path As String
path = App.path & "tamos.mdb"
conectar.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & path & ";"
conectar.Open
'Form1.Show
Form2.Show
End Sub
'FIN DEL MODULO
bueno ese es mi codigo soy principiante espero que alguien pueda ayudarme
GRACIAS
el error es el siguiente pon atencion:
en vez de text12.text=usr; debe decir usr=text12.txt;
sino es eso prueba con la sql="select * from alumnos where curp=' " & usr & " ' "
en vez de text12.text=usr; debe decir usr=text12.txt;
sino es eso prueba con la sql="select * from alumnos where curp=' " & usr & " ' "
hola me llami mariela y estudio programacion me gustaria platicar sobre visual.basic.net sobre algunos datos espero que me respondas cuidate bye
hola alguien me puede ayudar para que sirve el tim y los tipos de cadena porfis ayuda
