473,396 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Exporting table to txt file

33
Hi,
Using MS Access '97, i run a query over a table and need and then export the results into a txt file using the ms access wizard and an export specification.
The problem i have is with a field that loses all the preceding zero's when its exported and also adds a decimal place and two zero's.

Example 000000009, becomes 9.00 when exported.
The export specification is correctly set at 9 characters.

I have tried formating the field in the underlying table as both Text and also Number but it dosent make any difference.

What's confused me is that when you view the data during the export routine, the zero's are presented as expected and there are no decimal places either.

Any help appreciated
Apr 3 '09 #1
7 1717
NeoPa
32,556 Expert Mod 16PB
What's the extension of the output file (.Txt, .Csv, etc)?
What are you using to look at the results in the file (Notepad, TextPad, Word, Excel)?
Apr 3 '09 #2
Quizzed
33
Hi, the file extension is .txt and im viewing the results in notepad.
Apr 3 '09 #3
NeoPa
32,556 Expert Mod 16PB
@Quizzed
No issues there then.

I would guess then, that the field you're exporting is numeric and the export process is ignoring the format. To get around this use the Format() function around the numeric field in the query. The Format() function returns a text value, which should not be effected by any numeric formatting.
Apr 3 '09 #4
Quizzed
33
Yes the field in the underlying table is numeric.
I've applied the following to the select query;
Ordered: Format([Demand],"000000000")

When it is run, the values are displayed as i require them,
specifically - a value of 9 is returned as 000000009.

However, when i export the data into a txt file the zero's are removed and two decimal places are added
eg 9.00
Apr 3 '09 #5
NeoPa
32,556 Expert Mod 16PB
What's the Data Type of your field in the Output Specification? It needs to be set to Text.

When going into Advanced, open the Specification and select the visible columns by dragging from the one there (visible) across to the right (beyond the last one) and double-clicking on an edge at the top (header). This will show a number of previously invisible columns. One of these is Data Type. This must be set to Text.

Let me know how you get on.
Apr 3 '09 #6
Quizzed
33
Cheers NeoPa, quality. That works spot on.
Apr 3 '09 #7
NeoPa
32,556 Expert Mod 16PB
Very pleased to hear it.

That area can be quite fiddly sometimes but I've done a fair bit of work there over the past few years. I couldn't say why so many of the columns default to hidden in that view though. It seems a particularly unhelpful default setting to me :S
Apr 3 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Angel Cat | last post by:
I'm exporting a large file from a large Production database (SQL). Users are currently updating and inserting new records. Does the export take a snapshot of the data when it starts ? or will...
3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
3
by: Fran Zablocki | last post by:
I have a process that exports an Access table to a comma-delimited text file. One of the fields that is exported shows the date it was exported, using the Date() function. In the Access table, the...
4
by: russ | last post by:
Hi I am in the unfortunate position of having to use some code someone has programmed in access and i have to get the data out. i am picking a table to export and exporting it as a text file. ...
1
by: nunYa | last post by:
I am trying to use the DoCmd.TransferText method to export an access table to a Tab Delimited Text File. I have put the code behind the onclick event of a button and keep getting the error...
21
by: bobh | last post by:
Hi All, In Access97 I have a table that's greater than 65k records and I'm looking for a VBA way to export the records to Excel. Anyone have vba code to export from access to excel and have the...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
16
by: pmatzek | last post by:
I am attempting to automate a process involving importing a .txt file into an existing table, changing a date in each record, then exporting the table, again as a .txt file. One field contains a...
1
by: Marty Klunk | last post by:
I have an Access97 data base where we are exporting records out to a text file that is then sent to a customer via EDI transmission. The problem I am having is that during the export process access...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.