Exporting to Txt file

ypma

Registered User.
Local time
Today, 00:09
Joined
Apr 13, 2012
Messages
643
Having upgraded from ac2003 to ac2010 I wanted to export a query to a text file .In ac2003 no problem as the wizard took me through step by step .An example of ac 2003 is as follows #

#Private Sub Command665_Click()
On Error GoTo ProcError
Dim strPath As String
strPath = CurrentProject.Path
DoCmd.TransferText TransferType:=acExportDelim, _
SpecificationName:="ContactHome Source Specification", _
TableName:="qryPhoneNoOrder", _
FileName:=strPath & "\ContactHome.txt", _
HasFieldNames:=0
MsgBox "The selected Home Phone numbers have been exported " _
& "to the file ContactHome.txt" & vbCrLf _
& "in the folder:" & vbCrLf & strPath, vbInformation, _
"Export Complete..."
ExitProc:
Exit Sub

ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdExportTabDelim_Click event procedure..."
Resume ExitProc
End Sub #

I followed the export to text file with no problem , but the wizard did not show me an advance tab to produce a SpecificationName as I example above , any pointers as to what I am not doing correctly would be appreciated .

Regards Ypma
 
You must build the spec manually, using the export wizard.
Once built then you can put it in the command.
If export won't work,try import.
 
Ranman256 thank you for coming back so quickly. My problem is that the Export wizard which should take me through the procedure does not , in ac 2003 there was an advanced button which prompted me through , is there a export wizard in ac 2010 ? I only want to export to txt file as per my example in post 1.

Regards Ypma
 
so there is no Advanced button in neither import NOR export?
 
Seem to remember you just do it and save at the end, this creates a specification.
 
Tieval ,thank you for your input. Saving it did create a SpecificationName, so far so good , but I could not save it any further suggestions ?

Ypma
 
Attached seems to work, I just created a text export, saved it at the end and used it on the form button.
 

Attachments

Tieval, fantastic will now use that code in my module and give feed back

Many thank Ypma
 
Tieval. Worked on the database that I am working thank you again.
 

Users who are viewing this thread

Back
Top Bottom