The month is also present in the file name you can just extract the month part of the file name and convert it to a month name.
The month is also present in the file name you can just extract the month part of the file name and convert it to a month name.
I changed ".xlsx" to ".dbf" and it is still dropping the excel stuff into the table...
I assume it has something to do with
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,
correct, you're no longer importing a spreadsheet, you're importing data from a file, the same methodology applies you just have to set up an import spec a set the location of your database as a trusted location and you should be fine.
ok im not exactly sure what im supposed to change spreadsheet too...
what do i need to change this too if i am using dbase files?
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,
I changed, If Right(sFileName, 5) = ".xlsx" Then, to If Right(sFileName, 4) = ".dbf" Then
This might help. TransferSpreadsheet applies to spreadsheets. You are importing data from a data base.
http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx
Alan
I was looking at that page as well alan but I can't seem to get the syntax to work for importing a dbf file, it keeps telling me it can't find the source file when it's actually there. I'm still trying to find a solution.
if the easiest solution is to save the DBF as an excel file then that is what I will do.. I was just trying to avoid as much leg work as possible.
If you don't have to use VBA, then a simple import using the Get External Data Wizard should work.
See this:
http://www.census.gov/support/Access.html
also because I don't have any dbf files to test, this may be your solution:
http://www.sikhphilosophy.net/inform...-with-vba.html
Alan
Ok, this should do it, again I have included some dbf files and a delete macro that purges the table between tests.
The vb code is testing for files that match the format
mmddyy.dbf
Anything that doesn't match that will be ignored so if you're testing with a different file naming convention you'll have to change that part of the code.
On this DBF database; I try to run the module and it is asking for a Macro Name.
just make sure your cursor is between the SUB and END SUB of the module and click the green arrow and it will run without asking you
ok thanks....
I have another need if you are up for it...