Exporting to txt problem

timpepu

Registered User.
Local time
Today, 13:21
Joined
Nov 6, 2009
Messages
22
Hi !
I'd like to export to txt by choosing path and name !

I have done this but it doesn't work ?
What is the problem ?

Private Sub komento32_Click()
Dim wpath As String
wtaph = InputBox("Anna polku ja nimi tai OK jolloin voit valita polun")
DoCmd.TransferText acExportDelim, "", "taulukko kysely", "acFormatTXT", "wpath", False, ""

Vie_txt_Exit:
Exit Sub
Vie_txt_Err:
MsgBox Error$
Resume Vie_txt_Exit
End Sub
 
first off typo "wtaph" shoudl be wpath and you could try another way to get the path
and try this DoCmd.TransferText acExportDelim, "", "taulukko kysely", "acFormatTXT", wpath, False, ""
 
first off typo "wtaph" shoudl be wpath and you could try another way to get the path
and try this DoCmd.TransferText acExportDelim, "", "taulukko kysely", "acFormatTXT", wpath, False, ""

I tried it and I get : Run time error 2498 ,An expression you entered is the wrong data type for one of the arguments
 
You don't need quotes around acFormatTXT - it's an access constant.
 
OK, in the immediate window (the separate bottom section of the VB editor screen, maybe), try typing:

? wpath

this should show you the value held in the wpath variable (you might alternatively be able to see what it is just by hovering your mouse cursor over the name of the variable in your code, when it is in debug mode following an error)

What value is in the wpath variable?
 

Users who are viewing this thread

Back
Top Bottom