hello, i'm new to this site and I guess you could say im not an expert at access however I know a little bit of vb from past excel work and some access work.
I've been trying to write a little code that will be attached to a command button that will send out an email to a person that was selected in a combo box on the form where the button is.
My problem is that I have a dlookup statement in the code and it is spitting out an error that says "you canceled the previous operation." I've been looking all over the internet trying to solve this however it's just not working out.
I have all the correct spelling and I made sure they are referencing the correct tables and everything. any help would be much appreciated! thanks
Private Sub Send_To_AE_Click()
On Error GoTo Err_Send_To_AE_Click
Dim stDocName As String
Dim DLookupResults As String
DLookupResults = DLookup("[EMail]", "[EmailAddresses]", "[Inside_AE]='" & Forms![Main Form]![coboxInsideAE] & "'")
stDocName = "Issue Report"
DoCmd.SendObject acReport, stDocName, acFormatSNP, DLookupResults, , , , "Order Issue Report", "body of email"
Exit_Send_To_AE_Click:
Exit Sub
Err_Send_To_AE_Click:
MsgBox Err.Description
Resume Exit_Send_To_AE_Click
Set MyOutlook = Nothing
End Sub