wmdavidwynn
New member
- Local time
- Today, 14:38
- Joined
- Jul 15, 2005
- Messages
- 6
This question refers to an Access 2003 project.
I'm trying to create a fixed length text file as a result of a query using the 'Transfer Text' method. I have a query that prompts for two input parameters. These will select the records that I want to output. As it displays the correct records on the screen, I want these same records to be output as a fixed length text file.
Using 'Transfer Text' in VBA, when I put in the table name, the query displays the selected records but the whole table is output to a fixed length file. If I specify the stored procedure name, the query displays the correct records and then I get a message that says that VBA can't find the stored procedure. If I remove the table name, I get a message that says that "The action or method requires a Table Name argument". I haven't figured out how to specify that just the output of the query and not the whole file should be output as text.
Here's my code....
Private Sub FileOut_Click()
On Error GoTo Err_FileOut_Click
Dim stDocName As String
stDocName = "File Submittal"
DoCmd.OpenStoredProcedure stDocName, acViewNormal, acEdit
DoCmd.TransferText acExportFixed, , "MBS Input", "C:\Documents and settings\dwynn\desktop\m1234567-999.txt"
Exit_FileOut_Click:
Exit Sub
Err_FileOut_Click:
MsgBox Err.Description
Resume Exit_FileOut_Click
End Sub
----------------------------------
Any help will be greatly appreciated. Thanks.
I'm trying to create a fixed length text file as a result of a query using the 'Transfer Text' method. I have a query that prompts for two input parameters. These will select the records that I want to output. As it displays the correct records on the screen, I want these same records to be output as a fixed length text file.
Using 'Transfer Text' in VBA, when I put in the table name, the query displays the selected records but the whole table is output to a fixed length file. If I specify the stored procedure name, the query displays the correct records and then I get a message that says that VBA can't find the stored procedure. If I remove the table name, I get a message that says that "The action or method requires a Table Name argument". I haven't figured out how to specify that just the output of the query and not the whole file should be output as text.
Here's my code....
Private Sub FileOut_Click()
On Error GoTo Err_FileOut_Click
Dim stDocName As String
stDocName = "File Submittal"
DoCmd.OpenStoredProcedure stDocName, acViewNormal, acEdit
DoCmd.TransferText acExportFixed, , "MBS Input", "C:\Documents and settings\dwynn\desktop\m1234567-999.txt"
Exit_FileOut_Click:
Exit Sub
Err_FileOut_Click:
MsgBox Err.Description
Resume Exit_FileOut_Click
End Sub
----------------------------------
Any help will be greatly appreciated. Thanks.