You would put the code in a module in the Access database. Open the database, click on Modules and select new. Paste the code into the module and save it. Do not use the same name as any of the functions.
You can then call the function from the form event such as a button click. Here is a simple example.
Dim strRetMsg As String, strSubj As String
Dim strMsg As String, strEmail As String
strSubj = "Important Message"
strMsg = "The payroll process has completed."
strEmail = "John@Email.com"
strRetMsg = SendMessage(True, strSubj, strMsg, strEmail) Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.