Insert Form Field in a Module

This is a discussion on Insert Form Field in a Module within the ADO DAO RDO RDS forums in Framework and Interface Programming category; 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...

Go Back   Application Development Forum > Framework and Interface Programming > ADO DAO RDO RDS

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 11-07-2008, 06:10 PM
Dave Couch
Guest
 
Default Insert Form Field in a Module

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
Reply With Quote
  #2  
Old 11-07-2008, 06:55 PM
fredg
Guest
 
Default Re: Insert Form Field in a Module

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
Reply With Quote
  #3  
Old 11-09-2008, 05:38 PM
Dave Couch
Guest
 
Default Re: Insert Form Field in a Module

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
>

Reply With Quote
  #4  
Old 11-09-2008, 07:35 PM
fredg
Guest
 
Default Re: Insert Form Field in a Module

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
Reply With Quote
  #5  
Old 11-10-2008, 09:49 AM
Dave Couch
Guest
 
Default Re: Insert Form Field in a Module

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
>

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:09 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.