Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/06/2010, 16:02
RoyMalcolm
 
Fecha de Ingreso: junio-2010
Ubicación: maracaibo
Mensajes: 40
Antigüedad: 13 años, 10 meses
Puntos: 0
tengo problemas me podrian ayudar

les cuento amigos que estoy haciendo una consulta en sql server 2000 mediante vb6.0 la consulta me la hace perfectamente pero tengo 2 problemas

1- tengo 5 opciones para ordenar mis consultas.
son optionbutton
optCodigo
optDescripcicion
optPVP
optMarca
optReferencia

para ordenar uso un if then
ej :

If OptCodigo.Value = True Then
strSQL = "SELECT PrecioDetal * 1.12 AS PVP, tblProduct.CodRef, tblProduct.Descripcion, " & _
"tblProduct.Marca, tblExistencia.Existencia, tblProduct.IDUnidC , tblExistencia.Observaciones " & _
"FROM tblProduct " & _
"INNER JOIN tblExistencia ON tblProduct.CodRef = tblExistencia.CodRef " & _
"WHERE (Descripcion LIKE '%" & strDescripcion & "%' ) AND (Marca LIKE '%" & strMarca & "%') AND " & _
"(tblProduct.CodRef LIKE '%" & strCodigo & "%') AND (Observaciones LIKE '%" & strReferencia & "%') " & _
"AND ((PrecioDetal * 1.12) BETWEEN " & sngPVPdesde & " AND " & sngPVPhasta & ") " & _
"ORDER BY tblProduct.CodRef"

pero tengo q repetir la consulta 5 veces. podria ordenar declarando una variable para asi no hacer la consulta solo una sola vez