[AccessD] How to right justify numeric fields and pad with spaces on the left.

Stuart McLachlan stuart at lexacorp.com.pg
Mon Jun 6 20:12:31 CDT 2011


More efficient than a looping function: 

Function Pad(Datastring As String, PadChar As String, FieldLen As Long) As String
    Pad = Right$(String$(FieldLen, PadChar) & Datastring, FieldLen)
End Function


-- 
Stuart

On 6 Jun 2011 at 18:52, Debbie wrote:

> When I needed to do this, I made a function that i passed the string 
> and the number of total chars needed. It would loop through until the 
> length was the number of chars and would add a space ( or in my case a
>  0) to the beginning of the string.
> 
> Debbie
> 
> Sent from my iPhone
> 
> On Jun 6, 2011, at 4:12 PM, "Brad Marks" <BradM at blackforestltd.com> 
> wrote:
> 
> > We are using Access 2007 to create an output file for another firm.
> >
> > The specs for this file are dictated by the other firm.
> >
> > The specs call for numeric fields to be right justified and padded 
> > with spaces on the left.
> >
> > What is the best way to do this with Access 2007?
> >
> > Thanks,
> > Brad
> >
> > -- 
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 






More information about the AccessD mailing list