A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

FileDateTime Question



 
 
Thread Tools Display Modes
  #1  
Old November 14th, 2006, 12:12 AM posted to microsoft.public.access.forms
Jay
external usenet poster
 
Posts: 43
Default FileDateTime Question

I have gotten my code this far but not working.



Dim MyStamp as Date

MyStamp = FileDateTime(C:\Filecopy.txt)
If MyStamp = Date Then
'If Filecopy.txt modified date equals the current date.
MsgBox "File ok"
Goto End1
End If
MsgBox "File not ok"
End1:

  #2  
Old November 14th, 2006, 12:20 AM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default FileDateTime Question

Jay

"... not working..." is pretty loose...

Do you mean that it returns a value, but the wrong one?

Do you mean that it sometimes returns a wrong value, and sometimes the right
one?

Do you mean that it fails and generates an error message? (what does the
message say?)

Do you mean that your PC bursts into flames when you try this?

More specific descriptions will lead to more specific suggestions...

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Jay" wrote in message
...
I have gotten my code this far but not working.



Dim MyStamp as Date

MyStamp = FileDateTime(C:\Filecopy.txt)
If MyStamp = Date Then
'If Filecopy.txt modified date equals the current date.
MsgBox "File ok"
Goto End1
End If
MsgBox "File not ok"
End1:



  #3  
Old November 14th, 2006, 12:46 AM posted to microsoft.public.access.forms
Jay
external usenet poster
 
Posts: 43
Default FileDateTime Question

Jeff Boyce wrote:

Jay

"... not working..." is pretty loose...

Do you mean that it returns a value, but the wrong one?

Do you mean that it sometimes returns a wrong value, and sometimes the
right one?

Do you mean that it fails and generates an error message? (what does the
message say?)

Do you mean that your PC bursts into flames when you try this?

More specific descriptions will lead to more specific suggestions...

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Jay" wrote in message
...
I have gotten my code this far but not working.



Dim MyStamp as Date

MyStamp = FileDateTime(C:\Filecopy.txt)
If MyStamp = Date Then
'If Filecopy.txt modified date equals the current date.
MsgBox "File ok"
Goto End1
End If
MsgBox "File not ok"
End1:



Sorry about that. I just got off google and my head is spinning in
circles.

I have a need to compair a text file's modification date with the current
date. If it matches then it is good. If the modification date is older
then it is rejected.

I made a filecopy.txt file with the modified date matching the current date.
However, I get the msgbox "File not ok".

I am not getting a match between the current date and the modified date of
the file.

  #4  
Old November 14th, 2006, 12:50 AM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default FileDateTime Question

Jay

Were this my task, I'd probably start out displaying what the FileDateTime
actually is, before trying to compare.

By the way, if the name implies accurately, the value is a date/time value,
so comparing to only a date won't get it. You might want to take a look at
the functions that extract the date-only portion...

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Jay" wrote in message
...
Jeff Boyce wrote:

Jay

"... not working..." is pretty loose...

Do you mean that it returns a value, but the wrong one?

Do you mean that it sometimes returns a wrong value, and sometimes the
right one?

Do you mean that it fails and generates an error message? (what does the
message say?)

Do you mean that your PC bursts into flames when you try this?

More specific descriptions will lead to more specific suggestions...

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Jay" wrote in message
...
I have gotten my code this far but not working.



Dim MyStamp as Date

MyStamp = FileDateTime(C:\Filecopy.txt)
If MyStamp = Date Then
'If Filecopy.txt modified date equals the current date.
MsgBox "File ok"
Goto End1
End If
MsgBox "File not ok"
End1:



Sorry about that. I just got off google and my head is spinning in
circles.

I have a need to compair a text file's modification date with the current
date. If it matches then it is good. If the modification date is older
then it is rejected.

I made a filecopy.txt file with the modified date matching the current
date.
However, I get the msgbox "File not ok".

I am not getting a match between the current date and the modified date of
the file.



  #5  
Old November 14th, 2006, 02:23 AM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default FileDateTime Question

I'm surprised you're not getting an error. The argument to FileDateTime
needs to be a string:

MyStamp = FileDateTime("C:\Filecopy.txt")

Note though, that FileDateTime is going to return a date/time combination,
whereas Date only returns the date. The odds of you finding them with the
same value are extremely small (the file would have had to have been updated
at midnight this morning). To strip the time off MyStamp, use the DateValue
function:

If DateValue(MyStamp) = Date Then




--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Jay" wrote in message
...
I have gotten my code this far but not working.



Dim MyStamp as Date

MyStamp = FileDateTime(C:\Filecopy.txt)
If MyStamp = Date Then
'If Filecopy.txt modified date equals the current date.
MsgBox "File ok"
Goto End1
End If
MsgBox "File not ok"
End1:



  #6  
Old November 15th, 2006, 05:21 AM posted to microsoft.public.access.forms
Jay
external usenet poster
 
Posts: 43
Default FileDateTime Question

Douglas J. Steele wrote:

I'm surprised you're not getting an error. The argument to FileDateTime
needs to be a string:

MyStamp = FileDateTime("C:\Filecopy.txt")

Note though, that FileDateTime is going to return a date/time combination,
whereas Date only returns the date. The odds of you finding them with the
same value are extremely small (the file would have had to have been
updated at midnight this morning). To strip the time off MyStamp, use the
DateValue function:

If DateValue(MyStamp) = Date Then






That worked.
I had everything but the DateValue which gave me the date only.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.