|
-
Jan 29th, 2000, 04:24 AM
#1
Thread Starter
Hyperactive Member
Hi Everyone! I found this code in the archives and can't make it work. It's an evaluation timer.I don't know much about creating files and I get a Path not found error in the Open for Random line.I know the path doesn't exist because I'm trying to create it. Any Help? Here's the code:
------------------- 'declare inside a module
Type Record
FirstDate As Date
MaxDate As Date
Count As Integer
End Type
-------------------
Dim rec As Record
Dim strFile As String
Dim blnSuccess As Boolean
blnSuccess = False
strFile = "c:\windows\desktop\rnd\a.txt"
If (Dir(strFile) = "") Then 'not found then create a new one automatically
'''Here's where I get the error
Open strFile For Random As #1 Len = Len(rec)
rec.Count = 0
rec.FirstDate = Date
rec.MaxDate = Date
Put #1, , rec
blnSuccess = True
Close #1
Else
Open strFile For Random As #1 Len = Len(rec)
Get #1, , rec
Close #1
Open strFile For Random As #1 Len = Len(rec)
If (rec.MaxDate <= Date) Then
rec.MaxDate = Date
If (Date <= DateAdd("d", 30, rec.FirstDate)) Then
If (rec.Count < 9) Then
rec.Count = rec.Count + 1
blnSuccess = True
Else
MsgBox ("Exceeded 10 times")
End If
Else
MsgBox ("Over 30 days already")
End If
Put #1, , rec
Else
MsgBox ("Max date can not be later than today, file has been changed")
End If
Close #1
End If
If (blnSuccess) Then
MsgBox ("Put your main module here")
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|