Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Text Functions

Status
Not open for further replies.

lppa

Technical User
Apr 5, 2004
26
US
I am sending Purchase Order via email from Access form and need to align strings vertically in each line of the email.

PO# 39877

Date: 10/16/2011

-------------------------------------------------------------
Quantity Part Number Description
-------------------------------------------------------------

1 95405 BELT
2 W1023456345 TIMER
1 234786A MOTOR ASSEMBLY

-------------------------------------------------------------


Should I do it by adding spaces to a string, or is there another method?
 


hi,

You either have to account for x characters for a column or insert a TAB character to allign.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Can you show me the sample of the code?
 


What is YOUR CODE for generating this?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Here is the code:
Code:
Private Sub Command266_Click()

On Error GoTo Err_Command266_Click

 

   

 

    Dim stDocName As String

 

    'stDocName = "Empty_Report"

 

 

Exit_Command266_Click:    DoCmd.SendObject acSendNoObject, stDocName, acFormatXLS, , , , "PO# " & Me.InvoiceID, "Dial Appliance Service" & Chr(13) & "2156 Coyle Street" + Space(5) & Chr(13) & "Brooklyn, NY 11229" & Chr(13) & Chr(13) & Format(Date, "Short Date") & Chr(13) & Chr(13) & "PO# " & Me.InvoiceID & "  " & Chr(13) & Chr(13) & "Quantity              Part Number            Description" & Chr(13) & Chr(13) & Me.Part_Quantity_1 & "             " & Me.Part_Number_1 & "              " & Me.Part_Description_1 & Chr(13) & Chr(13) & Me.Part_Quantity_2 & "             " & Me.Part_Number_2 & "              " & Me.Part_Description_2 & Chr(13) & Chr(13) & "Please see attached file for details." & Chr(13) & Chr(13) & "Thank you" & Chr(13) & Chr(13) & "Dial Appliance Service | Tel: 718.368.1512 | Fax: 718.332.3841 | igor@dialappliance.com", True

Exit Sub

 

Err_Command266_Click:

 

    MsgBox Err.Description

    Resume Exit_Command266_Click

    

End Sub
Thanks
 


You have to count the number of characters for each column.

Use the Len() function to determine the length of the VALUE in that column.

Use the String() function to pad with SPACES to the REMAINING number of characters for that column.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
did you mean Space() function?
thanks
 



Sorry, yes, Space().

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks Skip,
works fine now
 



Grrrrrreat! :)

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top