 
			
				01/07/2010, 13:02
			
			
			     |  
      |    |    |    Fecha de Ingreso: junio-2010  Ubicación: maracaibo  
						Mensajes: 40
					  Antigüedad: 15 años, 4 meses Puntos: 0     |        |  
        problemas con decimales en textbox vb6.0        saludos...   
bueno mi poblema trata de de que en un texbox escribo decimales y me los toma como enteros. y eso me esta causando que en la consulta  en sql server 2000 me haga la busquesa con numeros enteros ej:   
si quiero buscar un producto que su PVP va de (0.1 a 0.3) siendo estos numeros decimales y menor a 1   
escribo en los texbox (0.01) y( 0.3); entonces me hace la busqueda de productos con PVP de (1 a 3) que son numeros enteros y mayores a 1.   
he intentado darles formato y eso pero de verdad no he logrado nada. 
este es el codigo si me pueden ayudar gracias de antemano.   
Option Explicit 
Dim cnConexionBD As ADODB.Connection 
Dim rsConexion As ADODB.Recordset 
Dim strSQL As String 
Dim strCodigo As String 
Dim sngPVPdesde As Single 
Dim sngPVPhasta As Single 
Dim strDescripcion As String 
Dim strMarca As String 
Dim strReferencia As String 
Private Sub cmdConsultar_Click() 
Set cnConexionBD = New ADODB.Connection 
     cnConexionBD.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;" & _ 
    "Initial Catalog=dbMundoSQL;Data Source=MDOINV02" 
    cnConexionBD.CursorLocation = adUseClient 
cnConexionBD.Open   
strDescripcion = txtDescripcion.Text ' V 
strMarca = txtMarca.Text             '  A 
strReferencia = txtReferencia.Text   '   RI 
sngPVPdesde = txtPVPdesde.Text       '     A 
sngPVPhasta = txtPVPhasta.Text       '      BLE 
strCodigo = txtCodigo.Text           '         S   
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 & ")"   
If OptCodigo.Value = True Then 
strSQL = strSQL & "ORDER BY tblProduct.CodRef" 
End If 
If OptDescripcion.Value = True Then 
strSQL = strSQL & "ORDER BY Descripcion" 
End If 
If OptMarca.Value = True Then 
strSQL = strSQL & "ORDER BY Marca" 
End If 
If OptPVP.Value = True Then 
strSQL = strSQL & "ORDER BY PVP" 
End If 
If OptReferencia.Value = True Then 
strSQL = strSQL & "ORDER BY Observaciones" 
End If   
Set rsConexion = cnConexionBD.Execute(strSQL) 
If rsConexion.RecordCount > 0 Then 
Set dgrConsulta.DataSource = rsConexion 
Else 
    dgrConsulta.Refresh 
    MsgBox "No Hay Existencia del Producto" 
End If 
dgrConsulta.Columns(0).Width = 1000  'Ancho columna PVP 
dgrConsulta.Columns(1).Width = 1300  'Ancho columnas Codigo 
dgrConsulta.Columns(2).Width = 3500  'Ancho columna Descripcion 
dgrConsulta.Columns(3).Width = 1500  'Ancho columnas Marca 
dgrConsulta.Columns(4).Width = 800   'Ancho columnas Existencia 
dgrConsulta.Columns(5).Width = 800   'Ancho columnas Unidades 
dgrConsulta.Columns(6).Width = 2500  'Ancho columnas Existencia 
txtTotalRegistros.Text = rsConexion.RecordCount   
End Sub   
Private Sub cmdRefrescar_Click() 
cnConexionBD.Close 
End Sub   
Private Sub cmdSalir_Click() 
End 
End Sub   
Private Sub txtPVPdesde_KeyPress(KeyAscii As Integer) 
If KeyAscii = Asc(",") Then 
KeyAscii = Asc(".") 
End If   
End Sub   
PD: en los textbox si presionas la (,) te lo transforma en (.) en el evento keypress gracias.           |