Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    @June,
    Thanks.
    That works perfectly.
    Now to tackle the multiple attachments part.

    Thanks

  2. #17
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    You might try a Split function to separate on the ";" and create an array.

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Where are the document paths coming from? If you don't have a table yet, as orange suggested can use the Split() function to build array for testing purpose, like:

    Sub SendEmails()
    x = SendHTMLEmail("to address", "test", "test", True, , Split("C:\My Docs\test1.txt;C:\My Docs\test2.txt", ";"))
    End Sub

    The function doesn't return anything to the calling procedure. If you make the Function a Sub then don't need the x=.

    Call SendHTMLEmail("to address", "test", "test", True, , Split("C:\My Docs\test1.txt;C:\My Docs\test2.txt", ";"))

    Note that I don't have space between the path strings.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    @orange, @june;
    Split() , How could I miss on that ? One of the function that goes hand in gloves with Arrays.
    Am sure that will work.
    Currently have a one to many tables; one table contains say the email id ( pk ) - the one side & the other table contains the actual physical paths ( on the local comp ) with email id as the FK ( the many side table ). I loop thro the records & get the attachments path.
    Was wondering whether I can enter the path in the Form field using the File Browsing window instead of physically entering the path.

    Thanks.

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Use FileDialog to grab file paths and put them wherever you want.
    Code:
    Dim fDialog As Office.FileDialog
    Dim varFile As Variant, strFile
    Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
    With fDialog
    .AllowMultiSelect = True
    .Title = "Select Files"
    ' Show the dialog box. If the .Show method returns True, the
    ' user picked at least one file. If the .Show method returns False, the user clicked Cancel.
    If .Show = True Then
       For Each varFile In .SelectedItems
          Debug.Print varFile
       Next
    Else
       MsgBox "You clicked Cancel in the file dialog box."
    End If
    End With
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #21
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Quote Originally Posted by June7 View Post
    Use FileDialog to grab file paths and put them wherever you want.
    @June.
    Thanks for the code. Will take me a couple of hours to test it & revert.
    If I am not wrong, I should be calling this in the On Click event of the Form field in which the path is to be entered.

    Thanks

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    I've never used Click event of textbox but I suppose that would work.

    Instead of the Debug.Print you would have code to populate the textbox. Could be looping structure to build a string of multiple selections from same folder.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #23
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Quote Originally Posted by June7 View Post
    Use FileDialog to grab file paths and put them wherever you want.
    Code:
    Dim fDialog As Office.FileDialog
    Dim varFile As Variant, strFile
    Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
    With fDialog
    .AllowMultiSelect = True
    .Title = "Select Files"
    ' Show the dialog box. If the .Show method returns True, the
    ' user picked at least one file. If the .Show method returns False, the user clicked Cancel.
    If .Show = True Then
       For Each varFile In .SelectedItems
          Debug.Print varFile
       Next
    Else
       MsgBox "You clicked Cancel in the file dialog box."
    End If
    End With
    Don't know why. Faced a bit of issue with the code. Errors kept on creeping up saying something about FileDialog, etc.
    All the same the code gave me guidelines on what to look for.
    Am currently using below ( Source : http://stackoverflow.com/questions/1...ry-as-a-string) :
    Code:
    Private Sub AttachmentLink_Click()
        Dim ofD As Object
        'Dim Fil
    
    
        Set ofD = Application.FileDialog(3)
    
    
        ofD.AllowMultiSelect = False
    
    
        If ofD.Show = False Then
            MsgBox "User Pressed Cancel"
        Else
            txtFilePath.Value = ofD.SelectedItems(1)
        End If
    End Sub
    Thanks

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 07-29-2014, 06:15 AM
  2. Help understanding code to run query
    By radguy in forum Programming
    Replies: 1
    Last Post: 07-28-2014, 05:42 AM
  3. Replies: 6
    Last Post: 03-26-2014, 10:04 AM
  4. Add picture to my email code
    By cbrsix in forum Programming
    Replies: 3
    Last Post: 09-25-2013, 08:26 AM
  5. smtp email code
    By alyon in forum Access
    Replies: 2
    Last Post: 05-15-2012, 07:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums