Solved

Simple Text Records

Posted on 2006-11-25
2
148 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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