Msgbox input as export file name

marleyuk

Registered User.
Local time
Today, 10:05
Joined
Feb 8, 2006
Messages
54
I have a file thats imported into the database, its added to a table, then queries are run on it. I want to then output it to a .txt file. The problem is i want the user to be prompted with an input box that asks the user what they would like to call the file. The input should be stored as a variable and this should be then used as the file name. Im not very good at vb and could use a bit of help. So far i have:

Dim strInput As String, strMsg As String

strMsg = "Please enter a name for the file to be saved as "
strInput = InputBox(Prompt:=strMsg, _
Title:="File namer", XPos:=2000, YPos:=2000)
MsgBox "Text file name " & strInput

I want to know how to make the text file use the variable from this input as the file name.

Thanks,
Marley.
 
Using your code

docmd.transfertext [TransferType] [,SpecificationName], strInput, fileName [, HasFieldNames], [HTMLTableName]

With the information you gave, this is the best that I can do. You didn't specify the datatype being imported, etc.

In any event, DoCmd.TransferText is the instruction you want.
 

Users who are viewing this thread

Back
Top Bottom