Solved

Simple Text Records

Posted on 2006-11-25
2
144 Views
Last Modified: 2011-09-20
This is simple, I just don't know how....

I have a timer in VB6 that runs every 30 seconds.  When it runs, I want a record added to a text file with the date/time stamp.  The way I have it now, it overwrites the previous text file with the new time, instead of keeping what is there, then adding a new line in the text file for the new timestamp.

Here is what I have:

******* Start Code *****
Sub Timer1_Timer()
        Open "C:\test\stamp.txt" For Output Access Write As #3
        Print #3, Date & " " & Time
        Close #3
End Sub
***** End Code *******


I don't want to read in from the text file each time, I just want to add a new line (with line feed?) with the new date and time.   The idea is to keep a list of everytime the timer fires.

Thanks as always for any light you can shed on this incredibly problem.  :-)
0
Comment
Question by:Danimal
2 Comments
 
LVL 29

Accepted Solution

by:
Nightman earned 35 total points
ID: 18010738
Try this:
******* Start Code *****
Sub Timer1_Timer()
    Open C:\test\stamp.txt For Append Shared As #3
    Print #3, Date & " " & Time
    Close #3
End Sub
***** End Code *******
0
 
LVL 1

Author Comment

by:Danimal
ID: 18010788
that's what I needed...YOU are da man!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now