A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Leading zeros



 
 
Thread Tools Display Modes
  #1  
Old July 29th, 2004, 03:18 PM
Lynne
external usenet poster
 
Posts: n/a
Default Leading zeros

I am developing a database with 135 fields, many of which must output right-justified with leading zeros with the sum of the characters entered and the zeros equaling the field length. The database output will be a fixed length string of 860 characters - the sum of all the field lengths. Fields that are blank must contain spaces equal to the field length.

I cannot find a solution in Access help (I am using Access 2000) or on-line. Any help with this will be greatly appreciated.
  #2  
Old July 29th, 2004, 06:28 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default Leading zeros

"=?Utf-8?B?THlubmU=?=" .(donotspam) wrote in
:


I am developing a database with 135 fields,


.... databases are usually made up of tables rather than fields. Tables are
made up of fields, but 135 fields in one table is _diagnostic_ of a Major
Design Problem. You really will be well served by applying some
normalisation to this setup.

many of which must output
right-justified with leading zeros with the sum of the characters
entered and the zeros equaling the field length.


That is not hard: you can use the Format property of the text box on the
form or report, and set to something like "00000000" for eight digits.

The database output
will be a fixed length string of 860 characters - the sum of all the
field lengths. Fields that are blank must contain spaces equal to the
field length.


For really tight output specifications, you are probably best served by
looking at the TransferText method, or even using Print # commands and a
specific VBA routine.

But before anything else, you really need to fix the table design.

Hope that helps


Tim F

  #3  
Old July 29th, 2004, 10:11 PM
Pat hartman
external usenet poster
 
Posts: n/a
Default Leading zeros

To create fixed format output you need to experiment a little. I have the easiest time when I create a query that orders the fields as they need to be exported and formats the dates and numerica fields as the target app is expecting them. Then you need to create an export specification. To do that you must export the query once (or as many times as it takes to get it right) manually using the File/save as wizard. It will give you the choice of delimited or fixed. You will need to press the advanced tab to see all the options and to adjust the lengths of some of the fields if necessary. This is also where you'll see the option to save the spec.

Once you have exported the file in the correct format, you can then use either the TransferText Method or Action and reference the export spec by name. All the settings will be applied and in the future it will take only a single instruction to export the file.

You could write a lengthy VBA procedure to format the output but you probably don't need to. If you haven't used the export wizard before you might not get it right the first time. But learn from each export and you'll be amazed at how easy it really is.
--
Bridge Players know all the Tricks


"Lynne" wrote:

I am developing a database with 135 fields, many of which must output right-justified with leading zeros with the sum of the characters entered and the zeros equaling the field length. The database output will be a fixed length string of 860 characters - the sum of all the field lengths. Fields that are blank must contain spaces equal to the field length.

I cannot find a solution in Access help (I am using Access 2000) or on-line. Any help with this will be greatly appreciated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Number Data Type Field and Leading Zeros Carlos Database Design 4 July 28th, 2004 07:29 PM
Linked Table field...strip off leading zeros of text Inyo55 Database Design 1 July 24th, 2004 01:11 AM
Check for lost leading zeros Bonnie General Discussion 4 June 15th, 2004 08:00 PM
Number with leading zeros SteveM Worksheet Functions 3 February 2nd, 2004 04:47 PM
Leading Zero's Tami Worksheet Functions 2 November 24th, 2003 03:27 PM


All times are GMT +1. The time now is 05:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.