Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Right align a text field on export (Access97,SR2)

    I'm not sure if this is even possible but before I go back and tell them that it can't be done, I thought I'd ask the gurus here... <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    I'm trying to export a recordset from Access as a fixed width text file... They want each field length defined and the final record length to be 89 characters...

    There is an Amount field that they want to be 10 characters long and right aligned in the output file (with no leading zeros)... I've changed the data type from long integer to text but that makes it left aligned in the output... If I leave it as long integer I can't set the field length (and the output actually shows ".00" at the end of each number too??!)

    Is there any way to do this? Thanks in advance for any help...

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Right align a text field on export (Access97,SR2)

    Can you use the format command, eg, Format(Amt,"00000000.00")

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Right align a text field on export (Access97,SR2)

    Have you created a fixed width export spec? That would be the simplest way to handle this.
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right align a text field on export (Access97,SR2)

    Nope... The point is that I don't want decimals... I want it to be right aligned without leading zeros... Thanks for trying... <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  5. #5
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right align a text field on export (Access97,SR2)

    Yes, I am using a fixed width output spec that I created and saved... There is no option for selecting the text data type with right alignment though... I figured I should therefore try format it before it got to the output spec (at least worth a try) but I checked help and although there is the format option of using "!" to force left alignment, there doesn't seem to be any option to force right alignment...

    Oh well, no biggie... We can only provide what the tools allow right? <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Thanks for trying Charlotte!

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Right align a text field on export (Access97,SR2)

    Export to Excel first, then save the Excel file as formatted text (*.prn).

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Right align a text field on export (Access97,SR2)

    Well then try this:

    Space$(10-Len(Format(Amount,"0"))) & Format(Amount,"0")

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Right align a text field on export (Access97,SR2)

    That didn't work well for me when I tried it - the last field wasn't exported at all <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •