forms_are_nightmares
Registered User.
- Local time
- Today, 08:43
- Joined
- Apr 5, 2010
- Messages
- 71
I believe this is just a coding issue and that I'm overlooking something very basic.
Scenario: I have an After Update function on a text box on a form that triggers an email. The VB code pulls information contained on the form and either puts it in the subject line, the TO field, and in the body of the email.
Problem: I want to add addresses to the CC field. These addresses come from 2 different tables. When the After Update executes, I get a Canceled Previous Operation error.
Here's the code (after all the declarations). It fails on the varCC line
response = MsgBox(msg, button, title)
If response = vbYes Then
staccount = Forms!frm_priority_worksheet.AName
stStore = Forms!frm_priority_worksheet.Store
ststate = Forms!frm_priority_worksheet.State
stWho = Forms!frm_priority_worksheet.AName
stWhere = "tbl_approver.account = " & "'" & stWho & "'"
varCC = DLookup("Approver", "tbl_approver", stWhere) And DLookup("Fmgr", "tbl_fmgr", ststate)
stSubject = "Closed Sourcing Request: " & staccount & " / Store: " & stStore & " / State: " & ststate
RecDate = Forms!frm_priority_worksheet.RDate
Spec = Forms!frm_priority_worksheet.PSpecialist
stText = "This sourcing request has been closed." & Chr$(13) & _
Chr$(13) & "Requested Date: " & RecDate & Chr$(13) & _
Chr$(13) & "Procurement Specialist: " & Spec & " "
DoCmd.SendObject , , acFormatTXT, varTo, varCC, , stSubject, stText, -1
Any help is greatly appreciated. All other code works properly
Scenario: I have an After Update function on a text box on a form that triggers an email. The VB code pulls information contained on the form and either puts it in the subject line, the TO field, and in the body of the email.
Problem: I want to add addresses to the CC field. These addresses come from 2 different tables. When the After Update executes, I get a Canceled Previous Operation error.
Here's the code (after all the declarations). It fails on the varCC line
response = MsgBox(msg, button, title)
If response = vbYes Then
staccount = Forms!frm_priority_worksheet.AName
stStore = Forms!frm_priority_worksheet.Store
ststate = Forms!frm_priority_worksheet.State
stWho = Forms!frm_priority_worksheet.AName
stWhere = "tbl_approver.account = " & "'" & stWho & "'"
varCC = DLookup("Approver", "tbl_approver", stWhere) And DLookup("Fmgr", "tbl_fmgr", ststate)
stSubject = "Closed Sourcing Request: " & staccount & " / Store: " & stStore & " / State: " & ststate
RecDate = Forms!frm_priority_worksheet.RDate
Spec = Forms!frm_priority_worksheet.PSpecialist
stText = "This sourcing request has been closed." & Chr$(13) & _
Chr$(13) & "Requested Date: " & RecDate & Chr$(13) & _
Chr$(13) & "Procurement Specialist: " & Spec & " "
DoCmd.SendObject , , acFormatTXT, varTo, varCC, , stSubject, stText, -1
Any help is greatly appreciated. All other code works properly