Hey all! need some help with an addition to the code below. Basically, when a user clicks the "open" button on the form the spreadsheet named paul.xls in C:\test is loaded into an Access table called "works"
The bit of code works great, but i'd like to add the feature where the spreadsheet will only load if it is within a date range of say +2 days of the date at the end of the string and not before i.e
if i try and open Paul_050407.xls it can only load up between 05 and 06 of April only and not before. Any help apprecited!
Private Sub open_Click()
Dim ImportDir As String, ImportFile As String
ImportDir = "c:\test\"
ImportFile = Dir(ImportDir & "paul.xls")
Do While ImportFile <> ""
DoCmd.TransferSpreadsheet acImport, 8, "works", ImportDir & ImportFile, True, "A:I"
ImportFile = Dir
Loop
End Sub
The bit of code works great, but i'd like to add the feature where the spreadsheet will only load if it is within a date range of say +2 days of the date at the end of the string and not before i.e
if i try and open Paul_050407.xls it can only load up between 05 and 06 of April only and not before. Any help apprecited!
Private Sub open_Click()
Dim ImportDir As String, ImportFile As String
ImportDir = "c:\test\"
ImportFile = Dir(ImportDir & "paul.xls")
Do While ImportFile <> ""
DoCmd.TransferSpreadsheet acImport, 8, "works", ImportDir & ImportFile, True, "A:I"
ImportFile = Dir
Loop
End Sub