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

ayudenme a terminar gracias de antemano

Estas en el tema de ayudenme a terminar gracias de antemano en el foro de Visual Basic clásico en Foros del Web. saludos amigos les comento que ya casi termino mi aplicacion es una consulta de productos que se hace de vb6.0 a sql server 2000 la ...
  #1 (permalink)  
Antiguo 23/07/2010, 12:51
 
Fecha de Ingreso: junio-2010
Ubicación: maracaibo
Mensajes: 40
Antigüedad: 13 años, 9 meses
Puntos: 0
Sonrisa ayudenme a terminar gracias de antemano

saludos amigos les comento que ya casi termino mi aplicacion es una consulta de productos que se hace de vb6.0 a sql server 2000

la consulta la ejecuto cuando se hace click en el boton consultar

pero tambien quiero que al escribir en el textbox la descripcion del producto y al presionar la tecla "ENTER" tambien se me ejecute la consulta.

yo pienso que es llamando el procedimiento mediante el evento keypress del textbox, estoy aprendiendo en esto de la pragramacion

este es todo el codigo del sistema:

Option Explicit
Dim cnConexionBD As ADODB.Connection
Dim rsConexion As ADODB.Recordset
Dim strSQL As String
Dim strCodigo As String
Dim strDescripcion As String
Dim strMarca As String
Dim strObservaciones As String
Dim strUbicaciondeFoto 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=SERVMUNDO"
cnConexionBD.CursorLocation = adUseClient
cnConexionBD.Open
''''''''''''''''''''''''''''''''''''''''''
strDescripcion = txtDescripcion.Text
strMarca = txtMarca.Text
strObservaciones = txtObservaciones.Text
strCodigo = txtCodigo.Text
''''''''''''''''''''''''''''''''''''''''''
strSQL = "SELECT PrecioDetal * 1.12 AS PVP, tblProduct.CodRef, tblProduct.Descripcion, " & _
"tblProduct.Marca, tblExistencia.Existencia, tblProduct.IDUnidC , tblExistencia.Observaciones, UbicaFoto" & _
" 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 '%" & strObservaciones & "%') " & _
"AND ((PrecioDetal * 1.12) BETWEEN " & txtPVPdesde.Text & " AND " & txtPVPhasta.Text & ") "

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 OptObservaciones.Value = True Then
strSQL = strSQL & "ORDER BY Observaciones"
End If

Set rsConexion = cnConexionBD.Execute(strSQL)
If rsConexion.RecordCount > 0 Then
Set dgrConsulta.DataSource = rsConexion
dgrConsulta.Visible = True
dgrConsulta.Columns(0).Width = 1000 'Ancho columna PVP
dgrConsulta.Columns(0).Locked = True
dgrConsulta.Columns(0).NumberFormat = "#,##0.00"
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 = 4000 'Ancho columnas Observaciones
dgrConsulta.Columns(7).Visible = False 'COLUMNA DE DIRECCION DE FOTOS
cmdRefrescar.Enabled = True
Else
MsgBox "No Hay Existencia del Producto", vbInformation
Set dgrConsulta.DataSource = rsConexion
dgrConsulta.Visible = False
End If
txtTotalRegistros.Text = rsConexion.RecordCount
End Sub

Private Sub cmdRefrescar_Click()
cnConexionBD.Close
dgrConsulta.Visible = False
End Sub


'Private Sub dgrConsulta_DblClick()
'If dgrConsulta.Columns(1).Value = rsConexion!UbicaFoto Then
'imgFotoProducto.Picture = LoadPicture(rsConexion!UbicaFoto)
'Else: imgFotoProducto.Picture = LoadPicture("C:\SAT\Pictures\SinFoto.Bmp")
'End If
'End Sub

Private Sub txtPVPdesde_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(",") Then
KeyAscii = Asc(".")
End If
If InStr(1, "0123456789.", Chr(KeyAscii)) = 0 And KeyAscii <> vbKeyBack Then
KeyAscii = 0
MsgBox "Tipo de Carácter no permitido"
End If
End Sub

Private Sub txtPVPhasta_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(",") Then
KeyAscii = Asc(".")
End If
If InStr(1, "0123456789.", Chr(KeyAscii)) = 0 And KeyAscii <> vbKeyBack Then
KeyAscii = 0
MsgBox "Tipo de Carácter no permitido"
End If
End Sub
  #2 (permalink)  
Antiguo 26/07/2010, 09:24
 
Fecha de Ingreso: octubre-2009
Mensajes: 19
Antigüedad: 14 años, 5 meses
Puntos: 1
Respuesta: ayudenme a terminar gracias de antemano

creo que esto te puede ayudar

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
MsgBox "llamo al procedimiento o funcion de consulta"
KeyAscii = 0
End If
End Sub
  #3 (permalink)  
Antiguo 30/07/2010, 22:31
Avatar de lokoman  
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 6 meses
Puntos: 47
Respuesta: ayudenme a terminar gracias de antemano

O sea:
Código vb:
Ver original
  1. if KeyAscii=13 then cmdConsultar_Click

Etiquetas: gracias, terminar
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 15:58.