• Jueves 28 de Marzo de 2024, 16:37

Autor Tema:  vb consultar archivo secuencial por fecha  (Leído 3175 veces)

truo

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
vb consultar archivo secuencial por fecha
« en: Sábado 14 de Marzo de 2015, 23:58 »
0
Hola soy Truo

El codigo que tengo hasta ahora me guarda los datos correctamente, pero no se como se hace un resumen de la venta de un dia con fecha, por ejemplo introduciendo una fecha 13\03\2015 que salga el resumen de dicho dia.

Código: [Seleccionar]

Dim fecha As date
Dim nombre As String
Dim apellido As String
Dim producto As String
Dim cantidad As Integer
Dim precio As Integer
Dim total As Integer
Dim archivo As String

Private Sub Command1_Click()
'nuevo
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text2.SetFocus
End Sub

Private Sub Command2_Click()
' guarda los datos
fecha = Text1.Text
nombre = Text2.Text
apellido = Text3.Text
producto = Text4.Text
cantidad = Text5.Text
precio = Text6.Text
total = Val(Text5.Text) * Val(Text6.Text)
archivo = App.Path & "\ventas.txt"
Open archivo For Append As #1
Write #1, fecha, nombre, apellido, producto, cantidad, precio, total
Close #1
End Sub


Private Sub Form_Load()
Text1.Text = Date
End Sub



Gracias

Haggen

  • Miembro activo
  • **
  • Mensajes: 88
  • Nacionalidad: mx
    • Ver Perfil
    • Mis proyectos
Re:vb consultar archivo secuencial por fecha
« Respuesta #1 en: Miércoles 25 de Marzo de 2015, 20:08 »
0
y cual es la estructura de tu archivo txt (que hace la función de la base de datos)?

Yetis

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Re:vb consultar archivo secuencial por fecha
« Respuesta #2 en: Jueves 26 de Marzo de 2015, 10:40 »
0
Porque no utilizas este sistema?
Código: [Seleccionar]
Dim fecha As Date
Dim nombre As String
Dim apellido As String
Dim producto As String
Dim cantidad As Integer
Dim precio As Integer
Dim total As Integer
Dim archivo As String

Private mcIni As clsIni
Dim INI_PATH As String
Dim sSeccion As String

Private Sub Command1_Click()
'nuevo
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text2.SetFocus
End Sub

Private Sub Command2_Click()
 ' guarda los datos
   sSeccion = Text1.Text

   INI_PATH = App.Path & "\Ventas.ini"
   With mcIni
      Call .writeValue(INI_PATH, sSeccion, "Fecha", Text1.Text)
      Call .writeValue(INI_PATH, sSeccion, "nombre", Text2.Text)
      Call .writeValue(INI_PATH, sSeccion, "apellido", Text3.Text)
      Call .writeValue(INI_PATH, sSeccion, "producto", Text4.Text)
      Call .writeValue(INI_PATH, sSeccion, "cantidad", Text5.Text)
      Call .writeValue(INI_PATH, sSeccion, "precio", Text6.Text)
      total = Val(Text5.Text) * Val(Text6.Text)
      Call .writeValue(INI_PATH, sSeccion, "total", total)
    End With
 
End Sub


Private Sub Command3_Click()
 ' Recuperar los datos
  sSeccion = Text1.Text
  INI_PATH = App.Path & "\Ventas.ini"
 
  Text1 = mcIni.getValue(INI_PATH, sSeccion, "Fecha")
  Text2 = mcIni.getValue(INI_PATH, sSeccion, "nombre")
  Text3 = mcIni.getValue(INI_PATH, sSeccion, "apellido")
  Text4 = mcIni.getValue(INI_PATH, sSeccion, "producto")
  Text5 = mcIni.getValue(INI_PATH, sSeccion, "cantidad")
  Text6 = mcIni.getValue(INI_PATH, sSeccion, "precio")

End Sub

Private Sub Form_Load()
Set mcIni = New clsIni

Text1.Text = Date
End Sub
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.