Ive compiled the following code but im having a few problems. The first is runtime error 2135 - this property is read only and cant be set. This error occurs during the export process, the file is exported but this error needs to do. The second problem is formatting, i want to add multiple queries to the one file in the one process. Also i want the text file to have titles for the imported data so it doesnt just appear as random numbers and the user can identify what it is they are seeing.
Code:
Function createtext()
Dim strFileName As String
Dim FileToCreate As String
Dim NewfileName As String
Dim NewFileType As String
strFileName = InputBox("Enter the name and the path you want for the file." & Chr(13) & "Example: C:\FileName")
FileToCreate = strFileName & ".txt"
DoCmd.TransferText acExportDelim, , "TableOrQueryName", FileToCreate, 1
NewFileType = strFileName & ".txt"
End Function