Dates being recorded into table as 12:00?!? (1 Viewer)

SteveClarkson

Registered User.
Local time
Today, 23:00
Joined
Feb 1, 2003
Messages
439
Hello all,

I am trying to record a whole load of dates into a table (tblOccurences).

My code calling a function to whack the records into the table
Code:
CreateOccurence DecreaseDate(Text0) 'Main Occurence
CreateOccurence (DateAdd("d", 1, DecreaseDate(Text0))) '1 Day Reminder
CreateOccurence (DateAdd("m", 1, DecreaseDate(Text0))) '1 Month Reminder
CreateOccurence (DateAdd("m", 2, DecreaseDate(Text0))) '2 Month Reminder

The DecreaseDate code
Code:
Public Function DecreaseDate(ByVal dteStart As Date) As Date

'Takes a date (dteStart) and checks if it is a Saturday or Sunday - if so, it decreases the date returned to the previous Friday.

    Dim dteTemp As Date

    dteTemp = dteStart

    Select Case Weekday(dteTemp)
        Case Is = 1
            DecreaseDate = DateAdd("d", -2, dteTemp)
        Case Is = 7
            DecreaseDate = DateAdd("d", -1, dteTemp)
        Case Else
            DecreaseDate = dteTemp
    End Select

End Function

The CreateOccurence Code
Code:
Public Function CreateOccurence(Criteria As Date)
Dim strSQL As String, strCriteria As Date

strCriteria = Criteria
strSQL = "INSERT INTO tblOccurence ( TaskID, DueDate ) SELECT tblTask.TaskID, Format(" & strCriteria & ",""dd/mm/yyyy"") AS DueDate FROM tblTask"

DoCmd.RunSQL strSQL

End Function


Say I put today's date in the Text0 box (rubbish names I know, still testing!), I would expect it to write 4 records to the tblOccurences table, with dates:
06/08/2007
07/08/2007
06/09/2007
06/10/2007

Instead, I get:
12:00:00 AM
12:00:00 AM
12:00:00 AM
12:00:00 AM

There is no date in there, I have checked formats etc, no date is recorded.

Help!!!


Thank you!
 

Users who are viewing this thread

Top Bottom