VBA code to email link to the other database (1 Viewer)

aman

Registered User.
Local time
Yesterday, 19:55
Joined
Oct 16, 2008
Messages
1,250
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 .
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 21:55
Joined
Feb 28, 2001
Messages
27,138
I think we need to know a bit more about these databases (plural) that you have named and their relationship to each other. From your description, we cannot tell enough to know what exactly is going on.
 

Ranman256

Well-known member
Local time
Yesterday, 22:55
Joined
Apr 9, 2015
Messages
4,339
There should be no difference in de vs db.
Is there vb code involved in this combo?
 

aman

Registered User.
Local time
Yesterday, 19:55
Joined
Oct 16, 2008
Messages
1,250
The_Doc_Man, 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
 

aman

Registered User.
Local time
Yesterday, 19:55
Joined
Oct 16, 2008
Messages
1,250
And also one more thing is happening if I change from accdb link to accde link.

The following code displays the name of the user in the heading section of the form in Agent database when accdb link is clicked.

But when accde link is clicked then nothing gets displayed in the heading section. :(
Code:
Me.txthidden = DLookup("[Staff Number]", "tblstaff", "struser='" & NameofUser() & "'")
 

aman

Registered User.
Local time
Yesterday, 19:55
Joined
Oct 16, 2008
Messages
1,250
Anyy help on this anyone ???
 

aman

Registered User.
Local time
Yesterday, 19:55
Joined
Oct 16, 2008
Messages
1,250
Guys, has anyone else faced the same issue? Can anyone please help me in this?

Thanks
 

Users who are viewing this thread

Top Bottom