How to send an email automatically when a new record is added

  • Thread starter Thread starter vandy
  • Start date Start date
V

vandy

Hi,

I have been reading the email thread and have an idea as to how to send an
email using a macro.

I have a command button on the header region of my form. I want to notify a
user when ever a new record is added on to a form. can anyone help me with
the steps. i am new to macro. I read about using DCount("[RecordId]",
"queryname")>0
but in am not sure how to interpret or use it

thanks for your help in advance
 
It's kind of simple. I have a VBA code that a friend here give me to check
new records.

but also may solve the problem with a macro that send mails with query
result or reports.

the criteria of that query is the new record and then on the form, in Atfer
Insert event you make run that macro.

Something like this.


Cheers,
Marco
 
Vandy,

Marco's idea of using the After Insert event is a good one, as this will
automatically apply to any new record added. So you will not need any
Condition such as the DCount idea you mentioned.

Therefore I think you should be able to use the SendObject action in
your macro to send the email. Have a look in the Help on SendObject
action, and then let us know if you have any more specific questions.
 
Thanks Steve and Marco's,

I took your advice and seem to get something working here. I have got the
macro send object set and the qry result now gets attached in an excel file
and is sent to the user. I have called the macro in the after update event of
the form but it fires only after i hit the button on the form will it not
automatically send the result to the user once the new record is inserted.

What i want to acheive is:

Also the qry result with all records are getting displayed in the excel
file. I want only the new values to be sent to the user.
Can i export it through an MDB file I dont see any MDB options in the file
output format for send object.

Also how to display the values from the form to the user eg. tell the user
the new record inserted is

company name : xyz
webpage : kkk

I guess this step would not be necessary if the record gets exported in
excel or mdb format.

Thanks for your patience.


Steve Schapel said:
Vandy,

Marco's idea of using the After Insert event is a good one, as this will
automatically apply to any new record added. So you will not need any
Condition such as the DCount idea you mentioned.

Therefore I think you should be able to use the SendObject action in
your macro to send the email. Have a look in the Help on SendObject
action, and then let us know if you have any more specific questions.

--
Steve Schapel, Microsoft Access MVP
Hi,

I have been reading the email thread and have an idea as to how to send an
email using a macro.

I have a command button on the header region of my form. I want to notify a
user when ever a new record is added on to a form. can anyone help me with
the steps. i am new to macro. I read about using DCount("[RecordId]",
"queryname")>0
but in am not sure how to interpret or use it

thanks for your help in advance
 
Back
Top