ajetrumpet
Banned
- Local time
- Today, 03:04
- Joined
- Jun 22, 2007
- Messages
- 5,628
Folks,
I need to use the transfer spreadsheet function to get an unknown amount of rows from Excel over into an existing table in Access. I am getting this data off of the internet, into a CSV, and then over to Access that way.
I need to use code similar to the .xlDown syntax in Excel (in place of the range I have specified). Can I write that with the function? Does Access read it?
Here are the steps I got right now. If it's not the best, please suggest how I can improve the process. thanks!
I need to use the transfer spreadsheet function to get an unknown amount of rows from Excel over into an existing table in Access. I am getting this data off of the internet, into a CSV, and then over to Access that way.
I need to use code similar to the .xlDown syntax in Excel (in place of the range I have specified). Can I write that with the function? Does Access read it?
Here are the steps I got right now. If it's not the best, please suggest how I can improve the process. thanks!
Code:
Dim strTABLE As String
strTABLE = "my" & MonthName(Month(Date)) & "transactions"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "mymarchtransactions", _
"mymarchtransactions.csv", no, [u][color=red][B]"A2:D100"[/B][/u][/color]
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblzone (transactiondate, Postingdate, transactiondescription, amount) " & _
"SELECT [f1], [f2], [f3], [f4] FROM " & strTABLE
DoCmd.SetWarnings True
CurrentDb.TableDefs.Delete (strTABLE)