15/10/2004, 21:30
|
| | Fecha de Ingreso: julio-2002
Mensajes: 50
Antigüedad: 22 años, 4 meses Puntos: 0 | |
Este es el codigo, ojala me puedas ayudar
Public var As Long
Public pun As Long
Public lafecha As Date
Public pet
Public ptj
Private Sub buscar_p_Click()
Data1.DatabaseName = "M:\reg\latin.mdb"
Data1.RecordSource = "panelista"
Data1.Refresh
Data1.Recordset.FindFirst "codigo_panelista='" & id_panelista.Text & " '"
If Data1.Recordset.NoMatch Then
r = MsgBox("no se encuentra", vbOKOnly, "")
Unload Me
Else
r = MsgBox("El panelista se encuentra", vbOKOnly, "")
id_panelista.Enabled = False
Text2.Enabled = False
Text4.Enabled = False
Text1.Enabled = False
Text6.Enabled = False
Text5.Enabled = False
Buscar_p.Enabled = False
Text2.Text = Data1.Recordset("nombre")
Text6.Text = Data1.Recordset("fecha_ingreso")
lafecha = Text6.Text
pet = DateDiff("ww", lafecha, Now)
Text7.Text = Data1.Recordset("direccion")
Text5.Text = pet
ptj = (Data1.Recordset("puntaje") + pet * 100)
Text4.Text = ptj
End If
End Sub
Private Sub buscar_c_Click()
Data1.DatabaseName = "M:\reg\latin.mdb"
Data1.RecordSource = "catalogo"
Data1.Refresh
Data1.Recordset.FindFirst "id_regalo='" & id_catalogo.Text & " '"
If Data1.Recordset.NoMatch Then
r = MsgBox("no existe el producto", vbOKOnly, "")
Unload Me
Else
r = MsgBox("El producto se encuentra", vbOKOnly, "")
id_catalogo.Enabled = False
Text3.Enabled = False
Text1.Enabled = False
buscar_c.Enabled = False
Text3.Text = Data1.Recordset("nom_reg")
Text1.Text = Data1.Recordset("costo")
End If
End Sub
Private Sub cancelar_Click()
id_panelista.Text = ""
Text2.Text = ""
Text6.Text = ""
Text5.Text = ""
Text7.Text = ""
Text4.Text = ""
Text1.Text = ""
id_catalogo.Text = ""
Text3.Text = ""
Text9.Text = ""
Text10.Text = ""
Buscar_p.Enabled = True
buscar_c.Enabled = True
End Sub
Private Sub cerrar_Click()
Unload Me
End Sub
Private Sub Command4_Click()
calcular
End Sub
Sub calcular()
On Error GoTo validar
validar:
If Err.Number = 13 Then
MsgBox " debe escribir numeros "
Text9.Text = ""
Else
Text10.Text = Text9.Text * Text1.Text
var = Text10.Text
End If
End Sub
Private Sub Form_Load()
Data2.Refresh
id_premio = Val(Label12.Caption) + 1
Label12.Visible = False
Dim sumatotal
sumatotal = 0
Label5.Caption = Format$(Now, "DD/MM/YYYY")
Timer1.Interval = 1
DeltaX = 100
End Sub
Private Sub ingresar_Click()
validar:
If Err.Number = 3021 Then
MsgBox "no hay registros disponibles"
End If
If ptj < var Then
r = MsgBox("el puntaje es mayor al que posee", vbOKOnly, "")
id_catalogo.Text = Empty
Text3.Text = Empty
Text1.Text = Empty
Text9.Text = Empty
Text10.Text = Empty
Else
Set conexion = OpenDatabase("M:\reg\latin.mdb")
conexion.Execute ("update panelista set puntaje=puntaje-" & var & " where codigo_panelista='" & id_panelista.Text & "'")
conexion.Close
Data1.DatabaseName = "M:\reg\latin.mdb"
Data1.RecordSource = "premio "
Data1.Refresh
Data1.Recordset.AddNew
Data1.Recordset("codigo_premio") = id_premio
Data1.Recordset("fecha") = Label5
Data1.Recordset("hora") = Label1
Data1.Recordset("cod_panelista") = id_panelista
Data1.Recordset.Update
Data1.Recordset.Close
Data1.DatabaseName = "M:\reg\latin.mdb"
Data1.RecordSource = "detalle "
Data1.Refresh
Data1.Recordset.AddNew
Data1.Recordset("id_regalo") = id_catalogo
Data1.Recordset("codigo_premio") = id_premio
Data1.Recordset("cantidad") = Text9
Data1.Recordset.Update
Data1.Recordset.Close
Data2.Recordset.Edit
Data2.Recordset("cod_premio") = id_premio
Data2.Recordset.Update
End If
Unload Me
End Sub
Private Sub Timer1_Timer()
Label1.Text = Time
End Sub |