You must name the module differently than the function. Access has no way of
knowing which is which. The code you need to run also has 4 arguments, 1 of
which comes from your table list, 1 comes from the form or is hard coded,
and the other 2 are optional (body and attachment) but they must come from a
form or be filled in:
Email(strTo As String, strSubject _
As String, Optional varMsg As Variant, Optional varAttachment As
Variant)
Don't use a macro to call your code. Macros are too limited to use anything
like this. Call it in the click event of a command button with an [Event
Procedure] by simply using the Call keyword:
Call Email(strTo, Me.txtSubject, Me.txtMessage)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com