hewstone999
Registered User.
- Local time
- Today, 10:33
- Joined
- Feb 27, 2008
- Messages
- 37
The code below imports the file Modified Time and Date into a table. However the value in the table = '39491.4423611111' , it should be: 13-Feb-2008 10:37:00. I've tried changing the data types to "Date/Time" and "Text" and still get the same value. How can i change it so it show the correct value?
The code below show this:
** Please Note **
'coltext = Table name - this value was from the Open Dialog box
'sbuffer2 = the file name
SQL = "Create TABLE " & coltext & "_FileDateAndTime (FileDate Text)"
DoCmd.RunSQL SQL
SQL17 = "ALTER TABLE " & coltext & "_FileDateAndTime ADD COLUMN FileTime Text"
DoCmd.RunSQL SQL17
Dim FName As String
Dim Result As Boolean
Dim TheNewTime As Double
Dim WhatTime As FileDateToProcess
FName = "E:\CSC\LDMS\LDMSDatabaseApp\MPI IFF Lorenzo\" & sBuffer2
WhatTime = FileDateLastModified
TheNewTime = GetFileDateTime(FileName:=FName, WhichDateToGet:=WhatTime)
If TheNewTime < 0 Then
Debug.Print "An error occurred in GetFileDateTime"
Else
sSQL = "INSERT INTO " & coltext & "_FileDateAndTime (FileDate) VALUES ('" & TheNewTime & "')"
DoCmd.RunSQL sSQL
End If
The code below show this:
** Please Note **
'coltext = Table name - this value was from the Open Dialog box
'sbuffer2 = the file name
SQL = "Create TABLE " & coltext & "_FileDateAndTime (FileDate Text)"
DoCmd.RunSQL SQL
SQL17 = "ALTER TABLE " & coltext & "_FileDateAndTime ADD COLUMN FileTime Text"
DoCmd.RunSQL SQL17
Dim FName As String
Dim Result As Boolean
Dim TheNewTime As Double
Dim WhatTime As FileDateToProcess
FName = "E:\CSC\LDMS\LDMSDatabaseApp\MPI IFF Lorenzo\" & sBuffer2
WhatTime = FileDateLastModified
TheNewTime = GetFileDateTime(FileName:=FName, WhichDateToGet:=WhatTime)
If TheNewTime < 0 Then
Debug.Print "An error occurred in GetFileDateTime"
Else
sSQL = "INSERT INTO " & coltext & "_FileDateAndTime (FileDate) VALUES ('" & TheNewTime & "')"
DoCmd.RunSQL sSQL
End If