I am currently building a database using Access 2016 and started using Redemption Loader to bypass the outlook security and enable me to send automatic emails from Access without user intervention.
I have purchased the distributable version of Redemption and registered the dll on my development machine and added the Redemption Loader module in the VBA editor. This works perfectly until another user logs into the database to test it as the redemption COM library reference is missing.
It was my understanding that Redemption Loader would load Redemption dynamically at run time but for anyone but me, it doesn’t work. I am a little inexperienced so think I’m definitely missing something but have been unable to find anything online to help.
I have code which sits behind the ‘on click’ event of a button on one of my forms but I’m wondering whether I need to load Redemption on start up of the database to enable others to use the database without errors. If so, how would I do this and what code would I need?
Here is a copy of the code I have referenced which is in my form:
Private Sub SaveFirstAuth_Click()
Dim olApp As Object
Dim olNamespace As Object
Dim olMail As Object
Dim SafeItem As Object
Dim oItem As Object
Dim Redemption As Object
Set Redemption = CreateObject("Redemption.RDOSession")
Dim OrgURN As String
Dim GrantURN As String
'On Error GoTo ErrorHandler
OrgURN = "Org URN " & Me.OrganisationURN
GrantURN = "Grant URN " & Me.GrantURN
If IsNull(Me.FirstAuthorisation) Then
If IsNull(Me.FirstAuthorisationDate) Then
If IsNull(Me.FinalAuthorisation) Then
MsgBox "Please add first authorisation, date and final authorisation"
End If
End If
Else
'Email message text
Dim msg As String
msg = "Organisation Name: " & OrganisationName & ",<p>" _
& GrantURN & ",<p>" & "Payment ready for final authorisation."
'Create outlook session
Set olApp = CreateObject("Outlook.Application")
Set olNamespace = olApp.GetNamespace("MAPI")
olNamespace.Logon 'logon to outlook
'Create a new mail item
Set olMail = olApp.CreateItem(0) 'O = olMailItem
Set SafeItem = CreateObject("Redemption.SafeMailItem")
SafeItem.Item = olMail
'Set sender address, text format, recipient, subject and send
SafeItem.SentOnBehalfOfName = "[email protected]"
SafeItem.BodyFormat = olFormatHTML
SafeItem.HTMLBody = msg
SafeItem.To = Me.FinalAuthorisation.Column(1)
SafeItem.Subject = "Payment for Authorisation"
SafeItem.Send
SafeItem.SaveAs "\ITCRTSupportDatabaseDocuments" & OrgURN & "" & GrantURN & "" & "Payment Authorised.msg"
'Disable authorisation fields and update payment status
FirstAuthorisation.Enabled = False
FirstAuthorisationDate.Enabled = False
FinalAuthorisation.Enabled = False
Me.PaymentStatus = "Awaiting final authorisation"
Me.SaveFirstAuth.Enabled = False
MsgBox "Payment authorised"
Me.Dirty = False
DoCmd.Close
Set SafeItem = Nothing
Set olMail = Nothing
Set olNamespace = Nothing
Set olApp = Nothing
End If
Exit Sub
ErrorHandler:
Dim ErrMsg As String
msg = Err.Number & ":" & Err.Description
MsgBox msg
End Sub
Any help would be really appreciated.
AlliCarr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.