Aqui mi codigo :
Código: Seleccionar todo
Option Explicit
Private Sub BUSCAR_KeyPress(KeyAscii As Integer)
Call Main(KeyAscii)
End Sub
Private Sub COSTO_KeyPress(KeyAscii As Integer)
Dim p As Integer, h As Integer
Dim cadena As String
Dim band As Boolean
h = Len(COSTO.Text)
cadena = COSTO.Text
For p = 1 To h
If Mid(cadena, p, 1) = "." Then
band = True
Exit For
Else
band = False
End If
Next p
If band = True Then
If InStr("0123456789", Chr(KeyAscii)) = 0 Then
If KeyAscii <> 8 Then KeyAscii = 0
End If
End If
If band = False Then
If InStr("0123456789.", Chr(KeyAscii)) = 0 Then
If KeyAscii <> 8 Then KeyAscii = 0
End If
End If
End Sub
Private Sub ENVIAR_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub Form_Load()
frmAgregar.Top = MDIForm1.Top + MDIForm1.Height / 2 - frmAgregar.Height / 2
frmAgregar.Left = MDIForm1.Left + MDIForm1.Width / 2 - frmAgregar.Width / 2
End Sub
Private Sub IVA_KeyPress(KeyAscii As Integer)
Dim p As Integer, h As Integer
Dim cadena As String
Dim band As Boolean
h = Len(IVA.Text)
cadena = IVA.Text
For p = 1 To h
If Mid(cadena, p, 1) = "." Then
band = True
Exit For
Else
band = False
End If
Next p
If band = True Then
If InStr("0123456789", Chr(KeyAscii)) = 0 Then
If KeyAscii <> 8 Then KeyAscii = 0
End If
End If
If band = False Then
If InStr("0123456789.", Chr(KeyAscii)) = 0 Then
If KeyAscii <> 8 Then KeyAscii = 0
End If
End If
End Sub
Private Sub MARKUP_KeyPress(KeyAscii As Integer)
Dim p As Integer, h As Integer
Dim cadena As String
Dim band As Boolean
h = Len(MARKUP.Text)
cadena = MARKUP.Text
For p = 1 To h
If Mid(cadena, p, 1) = "." Then
band = True
Exit For
End If
Next p
If band = True Then
If InStr("0123456789", Chr(KeyAscii)) = 0 Then
If KeyAscii <> 8 Then KeyAscii = 0
End If
End If
If band = False Then
If InStr("0123456789.", Chr(KeyAscii)) = 0 Then
If KeyAscii <> 8 Then KeyAscii = 0
End If
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Call Main(KeyAscii)
End Sub