Results 1 to 3 of 3

Thread: Trim (2003)

  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Trim (2003)

    I have a similar problem to <post#=717878>post 717878</post#> . I have this code in the OnClick expression of a button.

    Const strPath = "U:Common FoldersQuality Department SharedDrawings "
    Dim strFile As String
    strFile = Dir(strPath & "*" & Me.Customer_Order_No_1 & " - " & Me.Stock_Code_No_1 & ".pdf")

    If strFile = "" Then
    ' File not found, display warning
    MsgBox "No report found for this Drawing No.", vbExclamation
    Else
    ' File found, open it in default PDF reader
    Application.FollowHyperlink strPath & strFile
    End If

    It doesn't work because of trailing spaces after Customer Order No. The solution for the above post was to insert adding varStockCode1=Trim(varStockCode1 to the Sub Display Text line. How would I use Trim in this context?

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

    Re: Trim (2003)

    How about

    strFile = Dir(strPath & "*" & Trim(Me.Customer_Order_No_1) & " - " & Trim(Me.Stock_Code_No_1) & ".pdf")

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Trim (2003)

    Thanks Hans. Thats great.

Posting Permissions

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