Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TXT Export of Date field adds always time field

Status
Not open for further replies.

Niebotel

Programmer
Jan 1, 2007
169
NL
When I export my file as TXT file the txt file shows the my field Datum (this is a date) always with some time fields (Something like 00:00:00)
I must have in the asci file: dd/mm/yyyy
In the export I cannot define to skip the time.
So I have to convert the date before exporting in a text field with the right format.

I tried:Expr1: Day(Datum)&"/"& Month(Datum &"/"& Year(Datum) but then I get only one digit for the days from 1 to 9

I also tried: Expr1: DatePart("dd",[Datum]) etc but I get an error message which sais the syntax is not correct (i think something with the comma)

Looks like a simple problem again, but I do not get it solved!
 
Use the Format function:
Expr1: Format(Datum, "dd/mm/yyyy")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes I already tried, but after the export this is the result in de txt file:
2/12/2011 0:00:00

So I think I have to convert the date in the right format into a string ??
 
Export the formatting query, not the table.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I did export the query, but the formatted query has stil the date field.
 
Why not post the SQL code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here it is:
Way of worling:
Table
Query
Export:
DoCmd.RunSavedImportExport "Export-InterfaceFacturenQry"

The query looks like:
SELECT InterfaceFacturen.Boekjaar, InterfaceFacturen.Periode, InterfaceFacturen.Dagboek, InterfaceFacturen.Grootboekrekening, InterfaceFacturen.Debiteurennummer, InterfaceFacturen.Crediteurennummer, InterfaceFacturen.Tegenrekening, InterfaceFacturen.BTWcode, InterfaceFacturen.BTWperc, InterfaceFacturen.[BTW-bedrag valuta], InterfaceFacturen.BTWbedrag, InterfaceFacturen.[bedrag kredietbeperking], InterfaceFacturen.[bedrag kredietbeperking valuta], InterfaceFacturen.BedragEx, InterfaceFacturen.BedragIn, InterfaceFacturen.[Bedrag vreemde valuta], InterfaceFacturen.[Bedrag vreemde valuta In], InterfaceFacturen.Boekstuk, InterfaceFacturen.Kostenplaats, InterfaceFacturen.Kostendrager, InterfaceFacturen.Valuta, InterfaceFacturen.Koers, Format([Datum],"dd\/mm\/yyyy") AS Expr1, InterfaceFacturen.Factuurnummer, InterfaceFacturen.Omschrijving, InterfaceFacturen.Opmerking, InterfaceFacturen.Rekening, InterfaceFacturen.Boekbedrag, InterfaceFacturen.[Boekbedrag valuta], InterfaceFacturen.Boekingsverslag, InterfaceFacturen.Journaal, InterfaceFacturen.[op historisch verslag], InterfaceFacturen.Storno, InterfaceFacturen.Groepsuitsplitsing, InterfaceFacturen.Dossier, InterfaceFacturen.Beoordelingscode
FROM InterfaceFacturen;


The result in the query looks fine but after the export in the txt file: 0:00:00 is added.
 
I solved the problem by making some coding and checking character for character.
 

This looks very suspicious
[tt]
Format([Datum],"dd[red]\[/red]/mm[red]\[/red]/yyyy") AS Expr1
[/tt]

Have fun.

---- Andy
 

@Andy, it does, but appears to ignore the BACKSLASH character.

The issue seems to be the EXPORT to the text file.

Maybe the question should be, HOW are you EXPORTING the query results to the text file?

Are you specifying the Expr1 field as TEXT?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi huys,
Thanks for thinking, but as mentioned on 11 dec on 10.17 I have solved (work around) the problem by making some coding which checks character for character and makes it look like my specs.

What I saw was that it went wrong in the export; but by making the Date field to text field some of it was already solved; the rest via my coding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top