Results 1 to 3 of 3
  1. #1
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47

    VBA code to email link of the database from the other database


    Hi All

    In my project, When the Supervisor enters all the details in the form and click 'Send' button then a link gets sent to the Staff member email
    address which when clicked will open up another database and that database has a listbox which will show staff members pending activities that he needs to be completed.

    My code works fine if I send link to the accdb file in the email. All the pending activities get displayed in the listbox of that staff member.

    but if I create a accde file and the email gets sent with the link to the accde file which when opened doesn't display anything in the listbox.

    ANy ideas why its happening?

    Thanks .

  2. #2
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    To elaborate, I have Access database named "Test" . In a form , the supervisor enters all the details and click 'Send' button then a link to the other database
    named "Agent_database" gets sent to the Agent.
    Code:
    Public Sub 
    SendEmail()
        
        Set appOutLook = 
    CreateObject("Outlook.Application")
        Set MailOutLook = 
    appOutLook.CreateItem(olMailItem)
        Dim myLink As String
        myLink = 
    "L:\AgentDB.Accdb"
        With MailOutLook
        
       
         .To = 
    DLookup("[Email]", "tblStaff", "[strUser]='" & NameofUser() & "'")
       
        
           .Subject = FName & " needs to be signed off"
           
    .HTMLBody = FName & " has been completed by " & DLookup("[Staff Name]", 
    "tblstaff", "struser='" & NameofUser() & "'") & "." & vbCrLf 
    & vbCrLf & "The Reference number is " & gRef & ". " & 
    vbNewLine & vbNewLine & "Please click on this link to review and 
    signoff: <a href='" & myLink & "'>Click me</a>."  
         
    
        .sEnd
        End With
    End Sub
    When the Agent receives the email and click the link the Agent database gets opened up and the listbox displays all its pending activities to be completed.

    But if I make accde of Agent database and amend the vba code so that link to accde file gets sent instead . So when the Agent receives link to accde and open it then the listbox on agent database displays nothing in it.

    I hope I made it clear. Please let me know if anything is unclear.

    thanks

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    crossposted here https://www.access-programmers.co.uk...d.php?t=294241

    OP advised on another crosspost

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Link Two Database - Is it possible?
    By aamer in forum Access
    Replies: 6
    Last Post: 05-12-2017, 05:08 PM
  2. Replies: 8
    Last Post: 01-09-2016, 07:07 AM
  3. Replies: 1
    Last Post: 07-01-2015, 04:18 AM
  4. hyper link in vba email code
    By baronqueefington in forum Programming
    Replies: 2
    Last Post: 02-06-2015, 02:38 AM
  5. send email to email addresses in database?
    By cnstarz in forum Access
    Replies: 5
    Last Post: 03-02-2011, 09:46 PM

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