Excel & Access ETL Macro

 

 

Function LoadTreasury()

Dim strsql1 As String
Dim datestr As String

datestr = CStr(Year(Date - Day(Date))) & IIf(Month(Date - Day(Date)) < 10, "0" & CStr(Month(Date - Day(Date))), _
CStr(Month(Date - Day(Date))))

DoCmd.SetWarnings False

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, _
"Treasury" + datestr, "C:\Users\noswald\Documents\Treasury" + datestr + ".xlsx", -1

strsql1 = "INSERT INTO dbo_GBL_Treasury" + _
"(Curve_Date, Treasury_Curve, Treasury_Rate)" + _
"SELECT Curve_Date, Treasury_Curve, Treasury_Rate " + _
"FROM [Treasury" & datestr & "];"

DoCmd.RunSQL strsql1

DoCmd.SetWarnings True

End Function


Back to Macros

Back to Resume

Back to About Me