Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing contents of a record to a subroutine 1

Status
Not open for further replies.

fogcity

Programmer
Feb 8, 2008
8
US
In October I developed a process which creates and sends an email message using Outlook when a user clicks on a "Send" button on the main data entry form. The email message which is generated and sent is called an "Award Completion Request".

Now I want to develop a routine to send follow-up messages to anyone who has not responded to the initial ACR notice. This process would be fired off by clicking a button on a menu. The only differences between an original notice and a follow-up would be in the subject line and in the first paragraph in the message body. These differences are easily handled using a parameter.

So far I have developed a query to select the records and figured out out how to use a dynaset recordset to step through the list of records. The problem I'm having is with how to pass the field values necessary to dynamically build the email message.

The subroutine I wrote to send the email message is in a form module. I need to move the code for this subroutine to an application module and add parameters. Can anyone explain (or point me to an article or example on) how to pass the contents of a record as a parameter or a method to do the equivalent? Do I need to use arrays?

I will need to be able to call the subroutine from the form and from another subroutine.

Any ideas or suggestions greatly appreciated!
 
You may use the Recordset object as parameter.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

That will work for the batch routine to process follow-up notices.

How do use the same routine to send only 1 email message from the On Click event of a button on the form. I don't have a recordset set up in the form. How do I pass the current record from the form to the subroutine? Do I add code to the On Click event to define a recordset? If so how do I reference the current record to save it to the recordset?

Sorry if I'm being dense. I only started working with Access earlier this year.
 
A bound form has a Recordset property !
USe Me.Recordset

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top