I am creating a application to import a Excel worksheet and export a text file. I want the application to run when the user clicks a ICON on their desktop. I was trying to code a Macro using the RunCode action.
When I try to put in the function name I get the error "The expression you entered has a function name that Microsoft Office Access can't find". In the pull down it shows the miodules but not functions. It will not allow me to select the function or the module. Here is my code.
Module MarginRankImport
Private Function ImportMarginRanking()
FileName = GetFileName("Select the Margin File", "C\MarginRankApp\")
If FileName = "" Then GoTo Exit_ImportMarginRanking
FromPath = Left(FileName, InStrRev(FileName, "\"))
MsgBox "Importing records - Please wait", vbExclamation
DoCmd.RunSavedImportExport "Import-Margin Rank Assignment"
ConvertAMR
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from [ExportMarginRank]"
DoCmd.OpenQuery "ExportMarginRank Query"
DoCmd.SetWarnings True
ExpSpec = "MarginRank Export Specification"
TableName = "ExportMarginRank"
FileName = "MarginRank.txt"
DoCmd.TransferText acExportFixed, ExpSpec, TableName, FromPath &
FileName
Exit_ImportMarginRanking:
End Function
When I try to put in the function name I get the error "The expression you entered has a function name that Microsoft Office Access can't find". In the pull down it shows the miodules but not functions. It will not allow me to select the function or the module. Here is my code.
Module MarginRankImport
Private Function ImportMarginRanking()
FileName = GetFileName("Select the Margin File", "C\MarginRankApp\")
If FileName = "" Then GoTo Exit_ImportMarginRanking
FromPath = Left(FileName, InStrRev(FileName, "\"))
MsgBox "Importing records - Please wait", vbExclamation
DoCmd.RunSavedImportExport "Import-Margin Rank Assignment"
ConvertAMR
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from [ExportMarginRank]"
DoCmd.OpenQuery "ExportMarginRank Query"
DoCmd.SetWarnings True
ExpSpec = "MarginRank Export Specification"
TableName = "ExportMarginRank"
FileName = "MarginRank.txt"
DoCmd.TransferText acExportFixed, ExpSpec, TableName, FromPath &
FileName
Exit_ImportMarginRanking:
End Function
Last edited: