Consulta a tablas diferentes
Publicado por Marco (20 intervenciones) el 07/03/2006 20:48:34
son tres consultas difrentes con adodc diferentes se cae en la 3era. consulta en la linea Set rs = con.Execute(txtsql)
controlador ODBC acces pocos parametros se esperaba 1.
muchas gracias por la ayuda.
Private Sub Buscar_Click()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim txtsql As String
con.Open ("dsn=fsgprestamos")
txtsql = "select * from prestamos where rcm=" & Val(Text1.Text) & ""
If Text1.Text = "" Then
MsgBox "DEBE INGRESAR RCM"
Else
Set rs = con.Execute(txtsql)
If rs.EOF = False Then
Adodc1.RecordSource = txtsql
Adodc1.Refresh
con.Close
con.Open ("dsn=fsgprestamos")
txtsql = "select * from medicos where rcm=" & Val(Text1.Text) & ""
Set rs = con.Execute(txtsql)
If rs.EOF = False Then
Adodc2.RecordSource = txtsql
Adodc2.Refresh
Text2 = rs!nombre1
Text3 = rs!nombre2
Text4 = rs!ape_pat
Text5 = rs!ape_mat
Text6 = rs!condicion_vital
Text7 = rs!numerofsg
Text8 = rs!descripcion
con.Close
con.Open ("dsn=fsgprestamos")
txtsql = "select * from contrato where rcm=" & Val(Text1.Text) & ""
Set rs = con.Execute(txtsql)
If rs.EOF = False Then
Adodc3.RecordSource = txtsql
Adodc3.Refresh
Text9 = rs!idestamento
Text10 = rs!condicion
con.Close
If Text6.Text = 222 Then
Text6.Text = "VIVO"
Else
If Text6.Text = 223 Then
Text6.Text = "FALLECIDO"
End If
End If
Exit Sub
End If
End If
End If
End If
End Sub
controlador ODBC acces pocos parametros se esperaba 1.
muchas gracias por la ayuda.
Private Sub Buscar_Click()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim txtsql As String
con.Open ("dsn=fsgprestamos")
txtsql = "select * from prestamos where rcm=" & Val(Text1.Text) & ""
If Text1.Text = "" Then
MsgBox "DEBE INGRESAR RCM"
Else
Set rs = con.Execute(txtsql)
If rs.EOF = False Then
Adodc1.RecordSource = txtsql
Adodc1.Refresh
con.Close
con.Open ("dsn=fsgprestamos")
txtsql = "select * from medicos where rcm=" & Val(Text1.Text) & ""
Set rs = con.Execute(txtsql)
If rs.EOF = False Then
Adodc2.RecordSource = txtsql
Adodc2.Refresh
Text2 = rs!nombre1
Text3 = rs!nombre2
Text4 = rs!ape_pat
Text5 = rs!ape_mat
Text6 = rs!condicion_vital
Text7 = rs!numerofsg
Text8 = rs!descripcion
con.Close
con.Open ("dsn=fsgprestamos")
txtsql = "select * from contrato where rcm=" & Val(Text1.Text) & ""
Set rs = con.Execute(txtsql)
If rs.EOF = False Then
Adodc3.RecordSource = txtsql
Adodc3.Refresh
Text9 = rs!idestamento
Text10 = rs!condicion
con.Close
If Text6.Text = 222 Then
Text6.Text = "VIVO"
Else
If Text6.Text = 223 Then
Text6.Text = "FALLECIDO"
End If
End If
Exit Sub
End If
End If
End If
End If
End Sub
Valora esta pregunta


0