We have an access database that roughly 10 people use in Access 2010. We recently had a new employee join us and she is unable to run 2 different events that convert a report into an html document and send it in the body of the email. It works for everyone else but she gets this error when she tries to run the event procedure. All references are selected the same. I am assuming since she is new, it could be a user not authorized issue.
Here is the error: "No Current Record"
Here is the code:
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
exporttohtml
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
Sub exporttohtml()
Dim strline, strHTML As String
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
With MyItem
.To = joe@blah.com
.CC = ""
.BCC = ""
.Subject = "Daily Coffee Received Report"
End With
DoCmd.OutputTo acOutputReport, "DailyCoffeeReceived", acFormatHTML, "C:\myreport1.html"
Open "C:\myreport1.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
'MyItem.Send
End Sub
Thank you for any help!
Here is the error: "No Current Record"
Here is the code:
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
exporttohtml
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
Sub exporttohtml()
Dim strline, strHTML As String
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
With MyItem
.To = joe@blah.com
.CC = ""
.BCC = ""
.Subject = "Daily Coffee Received Report"
End With
DoCmd.OutputTo acOutputReport, "DailyCoffeeReceived", acFormatHTML, "C:\myreport1.html"
Open "C:\myreport1.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
'MyItem.Send
End Sub
Thank you for any help!