Export Query (1 Viewer)

access17401

Registered User.
Local time
Today, 15:07
Joined
Aug 24, 2017
Messages
33
Afternoon

I have made a query called "NAB Export Query", to send out a text file.
I have then created a command button on a form to run the export, with the following code:

Private Sub Command101_Click()
DoCmd.TransferText acExportDelim, , "NAB Export Query", "NAB.txt", False
End Sub

I have come across two stumbling blocks. In the query I have a field called Amount, this amount could be $150.50.
But in the export i need it to be in cents without the $ sign. The only thing I could think of was to create a
field with "Expr1:[amount]*100 which has an output of $15050, how do i go about removing the $ sign?

Secondly, I have done a lot of research but have found out how to do this, I want to define the export location to
C:\production but can't work this out either.

Any help will be greatly appreciated.
 

JHB

Have been here a while
Local time
Today, 23:07
Joined
Jun 17, 2012
Messages
7,732
Afternoon

I have made a query called "NAB Export Query", to send out a text file.
I have then created a command button on a form to run the export, with the following code:

Private Sub Command101_Click()
DoCmd.TransferText acExportDelim, , "NAB Export Query", "NAB.txt", False
End Sub

I have come across two stumbling blocks. In the query I have a field called Amount, this amount could be $150.50.
But in the export i need it to be in cents without the $ sign. The only thing I could think of was to create a
field with "Expr1:[amount]*100 which has an output of $15050, how do i go about removing the $ sign?
Try:
Code:
Expr1:[B][COLOR=Red]CLng([/COLOR][/B][amount]*100[B][COLOR=Red])[/COLOR][/B]
Secondly, I have done a lot of research but have found out how to do this, I want to define the export location to
C:\production but can't work this out either.
Try:
Code:
DoCmd.TransferText acExportDelim, , "NAB Export Query", "[B][COLOR=Red]C:\production\[/COLOR][/B]NAB.txt", False
 

access17401

Registered User.
Local time
Today, 15:07
Joined
Aug 24, 2017
Messages
33
Both worked perfectly, thanks
 

access17401

Registered User.
Local time
Today, 15:07
Joined
Aug 24, 2017
Messages
33
Sorry just thought of something else, the current file exports the data but without the headings is there a way to add in the table headings?
 

JHB

Have been here a while
Local time
Today, 23:07
Joined
Jun 17, 2012
Messages
7,732
Set the parameters for HasFieldNames to true instead of false.
Code:
DoCmd.TransferText acExportDelim, , "NAB Export Query", "C:\production\NAB.txt", [B][COLOR=Red]True[/COLOR][/B]
 

Users who are viewing this thread

Top Bottom