Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

ordenar registros con Dataareport

Estas en el tema de ordenar registros con Dataareport en el foro de Visual Basic clásico en Foros del Web. Hola todos buenas tardes Aqui con una duda nuevamente en mi programa mando llamar un data report el cual lo filtro por fecha y por ...
  #1 (permalink)  
Antiguo 03/08/2009, 12:27
 
Fecha de Ingreso: octubre-2008
Mensajes: 36
Antigüedad: 15 años, 6 meses
Puntos: 0
ordenar registros con Dataareport

Hola todos buenas tardes

Aqui con una duda nuevamente en mi programa mando llamar un data report el cual lo filtro por fecha y por caja(es un punto de venta) el reporte sale bien pero a la hora que le añado el comando order by me manda el reporte en blanco, ya estube checando en varias paginas en internet y segun yo la sintaxis esta bien no se si tengo algun otro problema aqui les pongo el codigo a ver si me puden ayudar de ante mando muchas gracias

Código:
Private Sub cmdaceptar_Click()

Dim ventadia As ADODB.Command
Dim Entorno As demybusiness
Dim fecha As Date
Dim caja As String

fecha = dtpfecha.Value
caja = cbxcajas.List(cbxcajas.ListIndex)

Set Entorno = New demybusiness

Entorno.condiaventa.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=" & server & "; DATABASE=" & dbase & " ;PWD=" & pass & "; UID=" & user & ";OPTION=3"
  
Set ventadia = Entorno.Commands("acmdiarioventa_Grouping")
ventadia.CommandType = adCmdText

If caja = "" Then
   MsgBox "Elija una Caja por favor"
Else
   ventadia.CommandText = "SHAPE {SELECT usuarios.USUARIO, ventas.USUARIO AS Expr1, usuarios.NOMBRE," _
   & "ventas.ESTADO, ventas.USUHORA, ventas.F_EMISION, ventas.IMPORTE, ventas.IMPUESTO, ventas.estacion, ventas.NO_REFEREN," _
   & "ventas.IMPORTE + ventas.IMPUESTO as total FROM usuarios, ventas WHERE (usuarios.USUARIO = ventas.USUARIO)" _
   & "and ventas.f_emision = " & Format(fecha, "yyyymmdd") & " and ventas.estacion = '" & caja & "'" _
   & "and ventas.estado = '" & "CO" & "' order by ventas.NO_REFEREN} AS acmdiarioventa COMPUTE acmdiarioventa, SUM(acmdiarioventa.'IMPORTE')" _
   & "AS TotalImporte, SUM(acmdiarioventa.'IMPUESTO') AS TotalIva BY 'estacion','USUARIO'"
   Load rptdiarioventa
   rptdiarioventa.Show 1, frmprincipal
   Unload Me
End If

End Sub
Si no le pongo el order by ventas.NO_REFEREN me manda el reporte bien solo que ordenado por usuario y yo lo necesito por el No. de referencia
  #2 (permalink)  
Antiguo 29/10/2009, 08:02
Avatar de lokoman  
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 7 meses
Puntos: 47
Respuesta: ordenar registros con Dataareport

& "and ventas.f_emision = " & Format(fecha, "yyyymmdd") & " and ventas.estacion = '" & caja & "'" _
& "and ventas.estado = '" & "CO" & "' order by ventas.NO_REFEREN} AS acmdiarioventa COMPUTE acmdiarioventa, SUM(acmdiarioventa.'IMPORTE')" _
& "AS TotalImporte, SUM(acmdiarioventa.'IMPUESTO') AS TotalIva BY 'estacion','USUARIO'"
-----------------
Por que pones: & "and ventas.estado = ' " & "CO" & " ' order by ventas.NO_REFEREN}

Si CO es un texto ponlo asi: & "and ventas.estado = 'CO'

El order by creo que lo haces en la linea: BY 'estacion','USUARIO'", cambia 'USUARIO' por ventas.NO_REFEREN, a ver que sale...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:02.