Hi,
Newbie here, still learning the basics. Thanks in advance for any help. I am working in VBA Access and feeding my code through a macro. I am getting the error message “The expression you entered has a function containing the wrong # of arguments.” I know this can be a pretty basic error but I can't find the problem. It's probably something silly. The strange thing is that the macro works fine and finishes making my table so I guess it has to do with some syntactical matter at the end (?)
Anyway, I appreciate any input. Code is below...
MK
Newbie here, still learning the basics. Thanks in advance for any help. I am working in VBA Access and feeding my code through a macro. I am getting the error message “The expression you entered has a function containing the wrong # of arguments.” I know this can be a pretty basic error but I can't find the problem. It's probably something silly. The strange thing is that the macro works fine and finishes making my table so I guess it has to do with some syntactical matter at the end (?)
Anyway, I appreciate any input. Code is below...
MK
Code:
Option Compare Database
Function ImportingDailyWarrantsFile()
Dim DateInput As String
Dim WarrMsg As String
Dim TableName As String
WarrMsg = "Pull warrants for which date [mmdd]?"
DateInput = InputBox(Prompt:=WarrMsg, Title:="InputBox Title")
TableName = "FT" & DateInput & "2013"
'Import the file
DoCmd.TransferText acImportDelim, "Regions Import Specification", TableName, "J:\Invest\Positive Pay\Download Files\FT" & DateInput & "2013.txt"
Call FormattingDailyWarrantsFile(TableName)
End Function
Function FormattingDailyWarrantsFile(TableName)
FormatText = "SELECT CDbl(Left([Account],10)) AS [Account_No], CDbl(Mid([Account],11,10)) AS [Check_No], "
FormatText = FormatText & "CDbl(Mid([Account],21,10))/100 AS [Amount], "
FormatText = FormatText & "Cdate(Cstr(Mid([Account],33,2)) & '/' & Cstr(Mid([Account],35,2)) & '/' & Cstr(Mid([Account],31,2))) AS [Date_Txt] "
FormatText = FormatText & "INTO " & TableName & "F FROM " & TableName
DoCmd.RunSQL FormatText
End Function
Comment