Formatting Problem

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
 
Simple Software Solutions

Hi

to change the '39491.4423611111' to a date/time format use the following:

CVDate(39491.4423611111)

Returns 13/02/2008 10:37:00

CodeMaster::cool:
 
Hi

to change the '39491.4423611111' to a date/time format use the following:

CVDate(39491.4423611111)

Returns 13/02/2008 10:37:00

CodeMaster::cool:


haha sorry my programming isnt that good. Where would i insert this into the code above?
 
Changing your field layout in the table should do the trick...

Else use the CDate supplied by DCRake in a query
 
Simple Software Solutions

Hi Again

You should use this command around the text that you want to convert to date/Time format; such as

Dim FDT As Date
FDT = CVDate(FileDateAndTime)

David
 

Users who are viewing this thread

Back
Top Bottom