troubleshooting Question

Write Record To txt File

Avatar of ace5342
ace5342 asked on
Programming
5 Comments1 Solution300 ViewsLast Modified:
i have got the data so it is saved into a txt file but can any one explain how to get it out and display the first record into a label3

here is my code


Private Sub Command1_Click()

With stock
    .ProductCode = product(0).Text
    .ProductName = product(1).Text
    .ProductType = product(2).Text
    .TQuantityCase = product(3).Text
    .TQuantitySingle = product(4).Text
    .ShopPrice = product(5).Text
    .WS1 = product(6).Text
    .WS2 = product(7).Text
    .WS3 = product(8).Text
    .WS4 = product(9).Text
    .WS5 = product(10).Text
    .WS6 = product(11).Text
    .WS7 = product(12).Text
    .WS8 = product(13).Text
    .WS9 = product(14).Text
End With

pathtofile = App.Path & "\stock.txt"
FileNumber = FreeFile
RecordLength = Len(stock)
Open pathtofile For Random As FileNumber Len = RecordLength
CurrentRecord = RecordLength + Val(1)
Put #FileNumber, CurrentRecord, stock
Close (FileNumber)
       
End Sub

Private Sub Command2_Click()
=============================
Get The First Record and display in the label box
=============================
End Sub


and the Module



Public Type tStock
    ProductCode As Variant
    ProductName As Variant
    ProductType As Variant
    Size As Variant
    TQuantityCase As Variant
    TQuantitySingle As Variant
    ShopPrice As Variant
    WS1 As Variant
    WS2 As Variant
    WS3 As Variant
    WS4 As Variant
    WS5 As Variant
    WS6 As Variant
    WS7 As Variant
    WS8 As Variant
    WS9 As Variant
End Type

Global CurrentRecord As Long
Global stock As tStock
Global pathtofile As String
Global FileNumber As Integer
Global RecordLength As Integer


any help would be great thanks

ASKER CERTIFIED SOLUTION
Mike Tomlinson
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros