Ver Mensaje Individual
  #4 (permalink)  
Antiguo 07/08/2008, 08:34
chelodelsur
 
Fecha de Ingreso: abril-2008
Mensajes: 208
Antigüedad: 16 años, 11 meses
Puntos: 2
Respuesta: Uso de variables en un select en formulario VB

Ahora
por si a alguin le sirve, el codigo quedaría así

Variable
Código:
Dim Vani As String
If txtAni <> "" Then
Vani = " and ani='" & txtAni & "'"
Else
Vani = ""
End If
Consulta
Código:
" Select call_Id as `ID Llamada`,port_number as `Puerto`, extension as `Anexo`, start_date as `fecha inicio`, start_time as `Hora Inicio`, end_date as `Fecha fin`, end_time as `Hora fin`,call_duration as `Duración`,dnis, ani,direction as `Direccion`, filename as `Nombre Archivo Audio`, filepath_id as `Volume Archivo` " _
         & " From `call` " _
         & " Where start_date>='2008/07/15'" _
         & " and start_date <='2008/07/31' " _
         & " and " & Vhorainicio & "" _
         & " and " & Vhorafin & "" _
         & " " & Vani & "" _      
         & " and " & Vdnis & "" _
         & " and " & Vanexo & "" _
         & " and " & Vllamada & "" _
         & " and " & Vpuerto & "" _
         & " and " & Vdireccion & "" _
         & " order by start_date desc ", cnn, adOpenKeyset, adLockOptimistic
PD:
Obviamente solo he cambiado el filtro del txtAni para este ejemplo.

Muchas gracias Kiha, me has ayudado un monton