naveguito17 de Diciembre del 2003
PreguntaHola a todos:
Tengo el siguiente problema,trato de hacer una búsqueda por diferentes criterios(de 1 a n) pero no he de cubrirlos todos necesariamente,en fin este es el codigo:
Private Sub CmdAceptar2_Click()
For i = 0 To 5
If Data(i).Enabled = True Then
Data(i).RecordSource = "select * from " & TABLA & "where" & Criterio
Data(i).Refresh
End If
Next
DBG.Visible = True
End Sub
Function TABLA() As String
If Data(i) = Data(0) Then TABLA = "Encoder_Hohner"
If Data(i) = Data(1) Then TABLA = "Encoder_Givi"
If Data(i) = Data(2) Then TABLA = "Encoder_Elgo"
If Data(i) = Data(3) Then TABLA = "Encoder_Posital"
If Data(i) = Data(4) Then TABLA = "Encoder_Scancon"
If Data(i) = Data(5) Then TABLA = "Encoder_WayCon"
End Function
Function Criterio() As String
Criterio = ""
For i = 0 To 16
If Txt(i) <> "" Then
Criterio = Criterio & Campos = "' & Txt(i) & " And ""
End If
Next
'Elijo los campos de los ComboBox y DataCombo
If Txtgiro <> "" Then Criterio = Criterio & Campos = "' & Txtgiro & " And ""
If Txtcodigo <> "" Then Criterio = Criterio & Campos = "' & Txtcodigo & " And ""
If Txteje <> "" Then Criterio = Criterio & Campos = "' & Txteje & " And ""
If Txtbrida <> "" Then Criterio = Criterio & Campos = "' & Txtbrida & " And ""
If Txtconexion <> "" Then Criterio = Criterio & Campos = "' & Txtconexion & " And ""
If Txtinterface <> "" Then Criterio = Criterio & Campos = "' & Txtinterface & " And ""
If Txtcircuito <> "" Then Criterio = Criterio & Campos = "' & Txtcircuito & " And ""
If Txtfuente <> "" Then Criterio = Criterio & Campos = "' & Txtfuente & " And ""
'Elimino el ultimo And de la consulta
Criterio = Trim(Mid(Criterio, 1, Len(Criterio) - 5))
End Function
Function Campos() As String
If Txt(i).Index = Txt(0) Then Campos = "Refprov"
If Txt(i).Index = Txt(1) Then Campos = "Ref"
If Txt(i).Index = Txt(2) Then Campos = "PasC"
If Txt(i).Index = Txt(3) Then Campos = "Tencod"
If Txt(i).Index = Txt(4) Then Campos = "Teje"
If Txt(i).Index = Txt(5) Then Campos = "Cons"
If Txt(i).Index = Txt(6) Then Campos = "CAxial"
If Txt(i).Index = Txt(7) Then Campos = "CRadial"
If Txt(i).Index = Txt(8) Then Campos = "Nrev"
If Txt(i).Index = Txt(9) Then Campos = "Nimp"
If Txt(i).Index = Txt(10) Then Campos = "RV"
If Txt(i).Index = Txt(11) Then Campos "RC"
If Txt(i).Index = Txt(12) Then Campos = "FT"
If Txt(i).Index = Txt(13) Then Campos = "TA"
If Txt(i).Index = Txt(14) Then Campos = "TF"
If Txt(i).Index = Txt(15) Then Campos = "IP"
If Txt(i).Index = Txt(16) Then Campos = "Hum"
If Txtgiro <> "" Then Campos = "Giro"
If Txtcodigo <> "" Then Campos = "Tipcod"
If Txteje <> "" Then Campos = "Tipeje"
If Txtbrida <> "" Then Campos = "Brida"
If Txtconexion <> "" Then Campos = "Tipcon"
If Txtinterface <> "" Then Campos = "Inter"
If Txtcircuito <> "" Then Campos = "CS"
If Txtfuente <> "" Then Campos = "Fuente"
End Function
El error me da en Function Campos,dice:"Llamada a procedimiento o argumentos no válidos"
Espero que alguien me puda ayudar.Muchas gracias
Tengo el siguiente problema,trato de hacer una búsqueda por diferentes criterios(de 1 a n) pero no he de cubrirlos todos necesariamente,en fin este es el codigo:
Private Sub CmdAceptar2_Click()
For i = 0 To 5
If Data(i).Enabled = True Then
Data(i).RecordSource = "select * from " & TABLA & "where" & Criterio
Data(i).Refresh
End If
Next
DBG.Visible = True
End Sub
Function TABLA() As String
If Data(i) = Data(0) Then TABLA = "Encoder_Hohner"
If Data(i) = Data(1) Then TABLA = "Encoder_Givi"
If Data(i) = Data(2) Then TABLA = "Encoder_Elgo"
If Data(i) = Data(3) Then TABLA = "Encoder_Posital"
If Data(i) = Data(4) Then TABLA = "Encoder_Scancon"
If Data(i) = Data(5) Then TABLA = "Encoder_WayCon"
End Function
Function Criterio() As String
Criterio = ""
For i = 0 To 16
If Txt(i) <> "" Then
Criterio = Criterio & Campos = "' & Txt(i) & " And ""
End If
Next
'Elijo los campos de los ComboBox y DataCombo
If Txtgiro <> "" Then Criterio = Criterio & Campos = "' & Txtgiro & " And ""
If Txtcodigo <> "" Then Criterio = Criterio & Campos = "' & Txtcodigo & " And ""
If Txteje <> "" Then Criterio = Criterio & Campos = "' & Txteje & " And ""
If Txtbrida <> "" Then Criterio = Criterio & Campos = "' & Txtbrida & " And ""
If Txtconexion <> "" Then Criterio = Criterio & Campos = "' & Txtconexion & " And ""
If Txtinterface <> "" Then Criterio = Criterio & Campos = "' & Txtinterface & " And ""
If Txtcircuito <> "" Then Criterio = Criterio & Campos = "' & Txtcircuito & " And ""
If Txtfuente <> "" Then Criterio = Criterio & Campos = "' & Txtfuente & " And ""
'Elimino el ultimo And de la consulta
Criterio = Trim(Mid(Criterio, 1, Len(Criterio) - 5))
End Function
Function Campos() As String
If Txt(i).Index = Txt(0) Then Campos = "Refprov"
If Txt(i).Index = Txt(1) Then Campos = "Ref"
If Txt(i).Index = Txt(2) Then Campos = "PasC"
If Txt(i).Index = Txt(3) Then Campos = "Tencod"
If Txt(i).Index = Txt(4) Then Campos = "Teje"
If Txt(i).Index = Txt(5) Then Campos = "Cons"
If Txt(i).Index = Txt(6) Then Campos = "CAxial"
If Txt(i).Index = Txt(7) Then Campos = "CRadial"
If Txt(i).Index = Txt(8) Then Campos = "Nrev"
If Txt(i).Index = Txt(9) Then Campos = "Nimp"
If Txt(i).Index = Txt(10) Then Campos = "RV"
If Txt(i).Index = Txt(11) Then Campos "RC"
If Txt(i).Index = Txt(12) Then Campos = "FT"
If Txt(i).Index = Txt(13) Then Campos = "TA"
If Txt(i).Index = Txt(14) Then Campos = "TF"
If Txt(i).Index = Txt(15) Then Campos = "IP"
If Txt(i).Index = Txt(16) Then Campos = "Hum"
If Txtgiro <> "" Then Campos = "Giro"
If Txtcodigo <> "" Then Campos = "Tipcod"
If Txteje <> "" Then Campos = "Tipeje"
If Txtbrida <> "" Then Campos = "Brida"
If Txtconexion <> "" Then Campos = "Tipcon"
If Txtinterface <> "" Then Campos = "Inter"
If Txtcircuito <> "" Then Campos = "CS"
If Txtfuente <> "" Then Campos = "Fuente"
End Function
El error me da en Function Campos,dice:"Llamada a procedimiento o argumentos no válidos"
Espero que alguien me puda ayudar.Muchas gracias
