Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/04/2007, 15:03
juantiva
 
Fecha de Ingreso: junio-2006
Mensajes: 109
Antigüedad: 18 años, 10 meses
Puntos: 2
Re: Select Sql Y Select En Excel..

Serian varias cosas:

1) La variable que utilizas "mifol" ingresala como parte del select que estas haciendo:

Código:
rs.open"select * from feriado where Folio = CASE WHEN "&mifol&" = '' THEN Folio ELSE "&mifol&" END order by Nombre, Folio, Imagen", ConexionBD,3,3
2) En la parte donde recorres y preguntas por el número de columnas valida mejor el recordset, agregando una validación más:

Código:
IF IsOpenRecordSet(rs) THEN
  With rs		 
    IF (Not .BOF And Not .EOF) THEN
    END IF
  END with
END IF
La función seria algo asi:
Código:
Function IsOpenRecordSet(objRS)
    If IsNull(objRS) Or objRS Is Nothing Then
        IsOpenRecordSet = False
        Exit Function
    End If

'objRS.State = 0 Indicates that the object is closed. 
'objRS.State = 1 Indicates that the object is open. 
'objRS.State = 2 Indicates that the object is connecting. 
'objRS.State = 4 Indicates that the object is executing a command. 
'objRS.State = 8 Indicates that the rows of the object are being 
    If IsObject(objRS) Then
        If objRS.State = 1 Then
            IsOpenRecordSet = True
        Else
            IsOpenRecordSet = False
        End If
    Else
        IsOpenRecordSet = False
    End If
End Function
Suerte