| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I have a module that sends an email with a message the "Proposal XXX has been added" I want the XXX to be the field "ProposalNumber" from my open form "SetupNewProposal". What is the syntax for adding this to the string?? Dave |
|
#2
| |||
| |||
| On Fri, 7 Nov 2008 15:10:02 -0800, Dave Couch wrote: > I have a module that sends an email with a message the "Proposal XXX has been > added" I want the XXX to be the field "ProposalNumber" from my open form > "SetupNewProposal". What is the syntax for adding this to the string?? > > Dave Why didn't you simply include this in your previous message? <g> And it would have been better had you actually included your code, otherwise I'm just guessing this will work. Anyway, this is what I would use. In the sub procedure name: What is the datatype of [ProposalNumber]? Number? Sub SendEmail(TheNumber as Integer) If it is Text, then: Sub SendEmail(TheNumber as Text) In the procedure you can then use the value TheNumber as you would any declared variable. In your form, you would send the value to the sub procedure using: SendEmail([ProposalNumber]) -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
|
#3
| |||
| |||
| Fred, I didn't think the 2 were directly related. Anyway, I got the procedure to run just fine, thank to your help. However, I have not figured out how to add the ProposalNumber Filed to the message. Here is the code: Dim objoutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment 'On Error GoTo ErrorMsgs ' Create the Outlook session. Set objoutlook = CreateObject("Outlook.Application") ' Create the message. Set objOutlookMsg = objoutlook.CreateItem(olMailItem) With objOutlookMsg ' Add the To recipient(s) to the message. Substitute ' your names here. Set objOutlookRecip = .Recipients.Add("dcouch@waldenassociates.net") objOutlookRecip.Type = olTo ' Add the CC recipient(s) to the message. ' Set the Subject, Body, and Importance of the message. .Subject = "New Proposal Added" .Body = "A New Proposal has been added." & vbCrLf & vbCrLf ' Resolve each Recipient's name. For Each objOutlookRecip In .Recipients If Not objOutlookRecip.Resolve Then objOutlookMsg.Display End If Next .Send End With Set objOutlookMsg = Nothing Set objoutlook = Nothing Set objOutlookRecip = Nothing Set objOutlookAttach = Nothing 'ErrorMsgs: 'If Err.Number = "287" Then 'MsgBox "You clicked No to the Outlook security warning. " 'Else 'MsgBox Err.Number, Err.Description 'End If End Sub In the line ".Body = "..." I want to it to say "Proposal Number" XXX "has been added." The XXX would be replaced with a text field from the open Form "NewProposalEntry" and the Field name of "ProposalNumber". I just can't figure out how to reference the filed value within the text string. Any help would be appreciated. Thanks again for the first answer. Dave "fredg" wrote: > On Fri, 7 Nov 2008 15:10:02 -0800, Dave Couch wrote: > > > I have a module that sends an email with a message the "Proposal XXX has been > > added" I want the XXX to be the field "ProposalNumber" from my open form > > "SetupNewProposal". What is the syntax for adding this to the string?? > > > > Dave > > Why didn't you simply include this in your previous message? <g> > And it would have been better had you actually included your code, > otherwise I'm just guessing this will work. Anyway, this is what I > would use. > > In the sub procedure name: > > What is the datatype of [ProposalNumber]? Number? > Sub SendEmail(TheNumber as Integer) > > If it is Text, then: > Sub SendEmail(TheNumber as Text) > > In the procedure you can then use the value TheNumber as you would any > declared variable. > > In your form, you would send the value to the sub procedure using: > > SendEmail([ProposalNumber]) > > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail > |
|
#4
| |||
| |||
| On Sun, 9 Nov 2008 14:38:01 -0800, Dave Couch wrote: > Fred, I didn't think the 2 were directly related. Anyway, I got the > procedure to run just fine, thank to your help. However, I have not figured > out how to add the ProposalNumber Filed to the message. Here is the code: > > Dim objoutlook As Outlook.Application > Dim objOutlookMsg As Outlook.MailItem > Dim objOutlookRecip As Outlook.Recipient > Dim objOutlookAttach As Outlook.Attachment > > 'On Error GoTo ErrorMsgs > > ' Create the Outlook session. > Set objoutlook = CreateObject("Outlook.Application") > ' Create the message. > Set objOutlookMsg = objoutlook.CreateItem(olMailItem) > With objOutlookMsg > ' Add the To recipient(s) to the message. Substitute > ' your names here. > Set objOutlookRecip = .Recipients.Add("dcouch@waldenassociates.net") > objOutlookRecip.Type = olTo > ' Add the CC recipient(s) to the message. > ' Set the Subject, Body, and Importance of the message. > .Subject = "New Proposal Added" > .Body = "A New Proposal has been added." & vbCrLf & vbCrLf > ' Resolve each Recipient's name. > For Each objOutlookRecip In .Recipients > If Not objOutlookRecip.Resolve Then > objOutlookMsg.Display > End If > Next > .Send > End With > Set objOutlookMsg = Nothing > Set objoutlook = Nothing > Set objOutlookRecip = Nothing > Set objOutlookAttach = Nothing > 'ErrorMsgs: > 'If Err.Number = "287" Then > 'MsgBox "You clicked No to the Outlook security warning. " > 'Else > 'MsgBox Err.Number, Err.Description > 'End If > End Sub > > In the line ".Body = "..." I want to it to say "Proposal Number" XXX "has > been added." The XXX would be replaced with a text field from the open Form > "NewProposalEntry" and the Field name of "ProposalNumber". > > I just can't figure out how to reference the filed value within the text > string. Any help would be appreciated. Thanks again for the first answer. > > Dave > > "fredg" wrote: > >> On Fri, 7 Nov 2008 15:10:02 -0800, Dave Couch wrote: >> >>> I have a module that sends an email with a message the "Proposal XXX has been >>> added" I want the XXX to be the field "ProposalNumber" from my open form >>> "SetupNewProposal". What is the syntax for adding this to the string?? >>> >>> Dave >> >> Why didn't you simply include this in your previous message? <g> >> And it would have been better had you actually included your code, >> otherwise I'm just guessing this will work. Anyway, this is what I >> would use. >> >> In the sub procedure name: >> >> What is the datatype of [ProposalNumber]? Number? >> Sub SendEmail(TheNumber as Integer) >> >> If it is Text, then: >> Sub SendEmail(TheNumber as Text) >> >> In the procedure you can then use the value TheNumber as you would any >> declared variable. >> >> In your form, you would send the value to the sub procedure using: >> >> SendEmail([ProposalNumber]) >> >> -- >> Fred >> Please respond only to this newsgroup. >> I do not reply to personal e-mail >> Gee, you left out the procedure name. From my reply to your original post>>>>> **************** In the sub procedure name: What is the datatype of [ProposalNumber]? Number? Sub SendEmail(TheNumber as Integer) If it is Text, then: Sub SendEmail(TheNumber as Text) ***************** Simply concatenate TheNumber into your text. ..Body = "Proposal Number " & TheNumber & " has been added." & vbCrLf & vbCrLf -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
|
#5
| |||
| |||
| Thanks Fred. I guess I just needed a refresher on concantation. Got everything working. Thanks again, Dave "fredg" wrote: > On Sun, 9 Nov 2008 14:38:01 -0800, Dave Couch wrote: > > > Fred, I didn't think the 2 were directly related. Anyway, I got the > > procedure to run just fine, thank to your help. However, I have not figured > > out how to add the ProposalNumber Filed to the message. Here is the code: > > > > Dim objoutlook As Outlook.Application > > Dim objOutlookMsg As Outlook.MailItem > > Dim objOutlookRecip As Outlook.Recipient > > Dim objOutlookAttach As Outlook.Attachment > > > > 'On Error GoTo ErrorMsgs > > > > ' Create the Outlook session. > > Set objoutlook = CreateObject("Outlook.Application") > > ' Create the message. > > Set objOutlookMsg = objoutlook.CreateItem(olMailItem) > > With objOutlookMsg > > ' Add the To recipient(s) to the message. Substitute > > ' your names here. > > Set objOutlookRecip = .Recipients.Add("dcouch@waldenassociates.net") > > objOutlookRecip.Type = olTo > > ' Add the CC recipient(s) to the message. > > ' Set the Subject, Body, and Importance of the message. > > .Subject = "New Proposal Added" > > .Body = "A New Proposal has been added." & vbCrLf & vbCrLf > > ' Resolve each Recipient's name. > > For Each objOutlookRecip In .Recipients > > If Not objOutlookRecip.Resolve Then > > objOutlookMsg.Display > > End If > > Next > > .Send > > End With > > Set objOutlookMsg = Nothing > > Set objoutlook = Nothing > > Set objOutlookRecip = Nothing > > Set objOutlookAttach = Nothing > > 'ErrorMsgs: > > 'If Err.Number = "287" Then > > 'MsgBox "You clicked No to the Outlook security warning. " > > 'Else > > 'MsgBox Err.Number, Err.Description > > 'End If > > End Sub > > > > In the line ".Body = "..." I want to it to say "Proposal Number" XXX "has > > been added." The XXX would be replaced with a text field from the open Form > > "NewProposalEntry" and the Field name of "ProposalNumber". > > > > I just can't figure out how to reference the filed value within the text > > string. Any help would be appreciated. Thanks again for the first answer. > > > > Dave > > > > "fredg" wrote: > > > >> On Fri, 7 Nov 2008 15:10:02 -0800, Dave Couch wrote: > >> > >>> I have a module that sends an email with a message the "Proposal XXX has been > >>> added" I want the XXX to be the field "ProposalNumber" from my open form > >>> "SetupNewProposal". What is the syntax for adding this to the string?? > >>> > >>> Dave > >> > >> Why didn't you simply include this in your previous message? <g> > >> And it would have been better had you actually included your code, > >> otherwise I'm just guessing this will work. Anyway, this is what I > >> would use. > >> > >> In the sub procedure name: > >> > >> What is the datatype of [ProposalNumber]? Number? > >> Sub SendEmail(TheNumber as Integer) > >> > >> If it is Text, then: > >> Sub SendEmail(TheNumber as Text) > >> > >> In the procedure you can then use the value TheNumber as you would any > >> declared variable. > >> > >> In your form, you would send the value to the sub procedure using: > >> > >> SendEmail([ProposalNumber]) > >> > >> -- > >> Fred > >> Please respond only to this newsgroup. > >> I do not reply to personal e-mail > >> > > Gee, you left out the procedure name. > > From my reply to your original post>>>>> > > **************** > In the sub procedure name: > > What is the datatype of [ProposalNumber]? Number? > Sub SendEmail(TheNumber as Integer) > > If it is Text, then: > Sub SendEmail(TheNumber as Text) > ***************** > > Simply concatenate TheNumber into your text. > > ..Body = "Proposal Number " & TheNumber & " has been added." & > vbCrLf & vbCrLf > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail > |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.