I have append query that I want to append records from one table to another plus one extra filed that I called “FileName” which I get from a variable.
I created Function in module
Public Function GetCSVFileName(strFileName)
Dim strPassValue As String
strPassValue = strFileName
GetCSVFileName = strPassValue
On my form in general section I defined variable as
Public strFileName as string
Then in sub procedure I assigned
value to variable and passed that variable to function
strFileName = "AAA"
Then I run query
DoCmd.Close acQuery, "QryAppAppendToTblArchivedMaster"
Or in SQL view:
INSERT INTO tblArchivedMaster ( SECTION, ROUTE, CSVFileName )
SELECT tblMaster.SECTION, tblMaster.ROUTE, GetCSVFileName([strFileName]) AS Expr1
I can follow execution function goes trough, however when it run query I stopped and
I am prompted all time for strFileName as parameter for query.