Unanswered: Use of date() not matching when importing XML
Fairly complicated problem that I have been stuck on for a while. I have the following procedure that imports an XML file from a PDF form to a new record in table "ApplicationInbox" and then moves the same XML file to an archive folder along with any other file located in the same temp folder. The folder is created with the format "dmmyy-hhmmss-AM/PM".
When the new record is created it also has a unique ref of dmmyy-hhmmss-AM/PM in the field ArchiveID. I need this because I want the user to be able to click a button to load the archive folder for a particular record.
The problem is that the two ref formatted 'dmmyy-hhmmss-AM/PM' don't always match and can sometimes be up to 2-3 seconds out.
Is there any way of transferring the 'fnow' to the ArchiveID field or can anyone think of a better way of achieving the same outcome.
The database is Access 2007 with a back and front end seperate.
Private Sub ImportApp_Click()
On Error GoTo ErrorHandle
Dim sfol As String, dfol As String, fnow As String
Set fco = CreateObject("Scripting.FileSystemObject")
fnow = (Format(Now(), "ddmmyy-hhmmss-AM/PM"))
Application.ImportXML "C:\Sample\Sample.xml", acAppendData
sfol = "C:\TempFolder"
dfol = "C:\Archive\" & fnow & ""
If Not fco.FolderExists(dfol) Then
Set fso = CreateObject("Scripting.FileSystemObject")
Name "C:\TempFolder\Sample.xml" As (dfol)
If Not fso.FolderExists(sfol) Then
MsgBox sfol & " is not a valid folder/path.", vbInformation, "Invalid Source"
ElseIf Not fso.FolderExists(dfol) Then
MsgBox dfol & " is not a valid folder/path.", vbInformation, "Invalid Destination"
On Error Resume Next
fso.MoveFile (sfol & "\*.pdf"), dfol
fso.MoveFile (sfol & "\*.mht"), dfol
fso.MoveFile (sfol & "\*.doc"), dfol
fso.MoveFile (sfol & "\*.jpg"), dfol
fso.MoveFile (sfol & "\*.tiff"), dfol
Select Case Err.Number
MsgBox "No Application Found"
...moving on from the previous post I am now at a stage where I need to cycle through a recordset from last to first checking whether the field is Null. If it is null then I need to add a bit of text which is basically a date formatted without the "/" and then continue up untill all fields have been checked.