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

crear un contador en vb6 con dao

Estas en el tema de crear un contador en vb6 con dao en el foro de Visual Basic clásico en Foros del Web. necesito enlasar a 2 tablas para poder dar de alta a los producto costos depende de producto Dim clave As String Dim preciocompra As Double ...
  #1 (permalink)  
Antiguo 30/09/2006, 12:50
 
Fecha de Ingreso: septiembre-2006
Mensajes: 5
Antigüedad: 18 años, 7 meses
Puntos: 0
Busqueda crear un contador en vb6 con dao

necesito enlasar a 2 tablas para poder dar de alta a los producto
costos depende de producto

Dim clave As String
Dim preciocompra As Double
Private Sub Command1_Click()
clave = Text1
consulta3 = "SELECT * FROM PRODUCTO WHERE id_producto='" & clave & "'"
Set rst3 = db.OpenRecordset(consulta3)
If rst3.EOF Then 'ANTES DEL PRIMER REGISTRO if 1
'If rst.EOF And rst.BOF Then 'cuando el registro no tenga nungun registro if 2
'id = 1
'Else 'else
'With rst 'costos
'.MoveLast
'id = .RecordCount 'contar registros
'End With
'id = id + 1
'End If
With rst 'costos
.AddNew
!id_costos = id
!precio_compra = CCur(Text4)
!a15dias = CCur(Text5)
!a30das = CCur(Text6)
.Update
End With
With rst2 'Productos
.AddNew
!id_producto = clave
![descripcion] = Text2
!existencia = Val(Text3)
!id_costo = id
.Update
End With
MsgBox "Tus datos fueron agregados"
Else 'else 1
MsgBox ("CAMBIE LA CLAVE DEL Producto")
End If 'end if
Text1.SetFocus
Err = 0
On Error Resume Next
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
rst3.Close
Set rst3 = Nothing
End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
End Sub

Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
sPathBase = App.Path & "\angelss.mdb"
Set db = OpenDatabase(sPathBase)
consulta = "SELECT * FROM COSTOS"
consulta2 = "SELECT * FROM PRODUCTO"
Set rst = db.OpenRecordset(consulta)
Set rst2 = db.OpenRecordset(consulta2)
End Sub
Private Sub Form_Unload(Cancel As Integer)
rst.Close
rst2.Close
Set rst = Nothing
Set rst2 = Nothing
Err = 0
Set fDAO = Nothing
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48 Or KeyAscii > 57) And (KeyAscii < 44 Or KeyAscii > 44)) Then
If (KeyAscii <> 8) Then KeyAscii = 0
End If
End Sub

Private Sub Text4_Change()
enigma = Val(Text4)
If enigma = 0 Then
Text5 = 0
Else
preciocompra = enigma * 0.3 + enigma
Text5 = CCur(preciocompra)
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48 Or KeyAscii > 57) And (KeyAscii < 44 Or KeyAscii > 44)) Then
If (KeyAscii <> 8) Then KeyAscii = 0
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48 Or KeyAscii > 57) And (KeyAscii < 44 Or KeyAscii > 44)) Then
If (KeyAscii <> 8) Then KeyAscii = 0
End If
End Sub
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 04:23.