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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Right align a text field on export (Access97,SR2)

    Author
    Topic
    #427951

    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… smile

    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…

    Viewing 1 reply thread
    Author
    Replies
    • #992911

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

      • #992932

        Nope… The point is that I don’t want decimals… I want it to be right aligned without leading zeros… Thanks for trying… smile

        • #992938

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

    • #992929

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

      • #992933

        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? smile

        Thanks for trying Charlotte!

        • #992939

          Well then try this:

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

          • #992942

            That didn’t work well for me when I tried it – the last field wasn’t exported at all sad

    Viewing 1 reply thread
    Reply To: Right align a text field on export (Access97,SR2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: