All pastes #21621 Raw Edit

yesterday

public text v1 · immutable
#21621 ·published 2005-08-30 18:38 UTC
rendered paste body
I really wish I knew who had their hands on this code before it came to me... they wanted to create a temporary database file, write to it from one (VB) form, read from it later from another, then delete it when eventually finished.  Reasonable enough! But then...

    Dim strDB As String
    Dim strtmp As String
    strtmp = Format(Now(), "yyyy") & "-" & Format(Now(), "mm") & "-" & Format(Now(), "dd")
    strDB = "C:\NiSSAN\logs\" & strtmp & "tmp.mdb"
    '(code to write data to file, extracted from other sources)

meanwhile, elsewhere...

    Dim strDB As String
    Dim strtmp As String
    strtmp = Format(Now(), "yyyy") & "-" & Format(Now(), "mm") & "-" & Format(Now(), "dd")
    strDB = "C:\NiSSAN\logs\" & strtmp & "tmp.mdb"
    '(code to display/save data from file, and wait for other user input)

Meanwhile, ELSEwhere...

    Dim strDB As String
    Dim strtmp As String
    strtmp = Format(Now(), "yyyy") & "-" & Format(Now(), "mm") & "-" & Format(Now(), "dd")
    strDB = "C:\NiSSAN\logs\" & strtmp & "tmp.mdb"
    If fs.FileExists(strDB) Then
        Kill (strDB)
    End If

Yes folks, they really did generate the filename three different times, using current timestamps as part of the filename each time!