PC Review

Thread Tools Rate Thread

Importing excel to access as the results of a file search

Posts: n/a
      31st Mar 2008

i'm struggling with the below code, what i would like to do is to search for
the workbook "dailyfile310308.xls" and import it into access.

my problem is the filename changes and the folder changes.

so far i have..

Sub FindMaxFileandImport()
Dim iSearch As Variant
Dim iCount As Long
Dim max_file As String

max_file = "dailyfile" & Format(Date, "ddmmyy") & ".xls"
Set iSearch = Application.FileSearch

With iSearch
.LookIn = "Mypath"
.SearchSubFolders = True
.Filename = max_file
If .Execute > 0 Then
For iCount = 1 To .FoundFiles.Count
DoCmd.TransferSpreadsheet acImport, 9, "Max_csv_table",
..FoundFiles(i), True

Next iCount
MsgBox "The file does not exist."
End If
End With
End Sub


Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't do a search in Outlook 2007 (Instant search encountered aproblem while trying to display search results) Bradley Burton Microsoft Outlook Discussion 0 14th Apr 2008 01:41 PM
Importing Adobe Acrobat Search Results into Access bsdurbin@gmail.com Microsoft Access 0 27th Dec 2006 05:57 AM
Capture the results of a Windows explorer Search file and save the results Larry Frazin Microsoft Windows 2000 Printing 0 17th Sep 2003 10:07 PM
Search Results leading to "Premium Search Results" Leon Funnell Windows XP Internet Explorer 2 11th Jul 2003 04:54 AM
Re: Search Results leading to "Premium Search Results" Tom Windows XP Internet Explorer 0 8th Jul 2003 06:55 PM




All times are GMT +1. The time now is 11:30 PM.