Dear Experts,
I have the following problem. I'm generating output txt files from access (an access 2002 table is converted into deleimited text with tabs including field names). For that I have a small function that I call from the main VBA script, which includes the so-called Export Specification. Everything works fine as long as the name of the output file is written in characters in the file specification of the DoCmd.TransferT ext command.
Nevertheless, if I try to assign a dynamic name (say FileX where X can vary from 0 to 9) I get a message error. However if I Debug.Print my current string variable containing the path and the file name, I see the correct name (e.g. C:\Directory\Fi leX.txt). Does anybody has an idea what's going on here....
Marcin
The function called from the main code is the following:
The resulting Debug.Print is:
I have the following problem. I'm generating output txt files from access (an access 2002 table is converted into deleimited text with tabs including field names). For that I have a small function that I call from the main VBA script, which includes the so-called Export Specification. Everything works fine as long as the name of the output file is written in characters in the file specification of the DoCmd.TransferT ext command.
Nevertheless, if I try to assign a dynamic name (say FileX where X can vary from 0 to 9) I get a message error. However if I Debug.Print my current string variable containing the path and the file name, I see the correct name (e.g. C:\Directory\Fi leX.txt). Does anybody has an idea what's going on here....
Marcin
The function called from the main code is the following:
Code:
Option Compare Database
Function TXTsendTblFinalMATLABTable1()
WlistNum = DLookup("Lists", "WorkingIndexList")
Debug.Print "WListNum", WlistNum
strJname = "C:\MATLAB\DB\NEWPROJECTS\COUNTRY_SELECT\List" & WlistNum & ".txt"
Debug.Print "strJname", strJname
DoCmd.TransferText transfertype:=acExportDelim, _
specificationname:="FinalMATLABTable1 Export Specification", _
TableName:="FinalMATLABTable1", _
Filename:=strJname, _
hasfieldnames:=True
End Function
The resulting Debug.Print is:
Code:
OldNameSpecialRegion NewNameRegion OldNameSpecialRegionID NewNameRegionCode OldNameCodeBloomberg NewNameCode WListNum 37 strJname C:\MATLAB\DB\NEWPROJECTS\COUNTRY_SELECT\List37.txt
Comment