473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Sending auto email from database

I need help. I want to send auto e-mail if a value of a field is higher than a set value. For an example, if someone's systolic blood pressure is more than 140, this value will be automatically be e-mail along with the patients id number. And I like the database to do the same whenever a value is higher than the set value to be e-mail. I will be very grateful if anyone can tell me how to do that. Thanks.
Jul 28 '06 #1
7 8123
comteck
179 100+
Try "SendObject" under macros.

comteck
Jul 28 '06 #2
comteck
179 100+
Sorry about that response. You did say you wanted to do it automatically. Ok, forget the macro. Do it using code instead. The format is as follows:

expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

Most of these fields are optional, but you must use separators for them.

Assume the field on your form with the e-mail address is called txtEmailAddr, and the report you want to send is called "Report1". Add the following code to the OnClick Event of a command button:

Private Sub Command6_Click()
Dim emailaddr As String
emailaddr = Me.txtEmailAddr

DoCmd.SendObject acSendReport, _
"Report1", , emailaddr, , , "Report One", , False

End Sub

Hope this helps.
comteck
Jul 28 '06 #3
Thank you. But I want to send if any person's Blood pressure value is more than 140 or lets say if anyone has Hypertension, nto all the records. Beside I want to it send this info if a new patient who has hypertension is entered.
Can I do that? Thanks.
Jul 28 '06 #4
comteck
179 100+
Ok, you should be able to modify this code to make it fit your application. For example, for the hypertension, you can use the "LostFocus" for a textbox with a name of, say, "txtCondition". The code would be as follows:

Private Sub txtCondition_LostFocus()
Dim emailaddr As String
emailaddr = Me.txtEmailAddr

If Me.txtCondition = "hypertension" Then
DoCmd.SendObject acSendReport, _
"Report1", , emailaddr, , , "Report One", , False
End If

End Sub

You can then do the same for the blood pressure textbox.

If you wanted to check either one or the other on the same form, then you can use the OnClose event procedure for the form:

Private Sub Form_Close()
Dim emailaddr As String
emailaddr = Me.txtEmailAddr

If Me.txtCondition = "hypertension" Or Me.txtBloodPressure > 140 Then
DoCmd.SendObject acSendReport, _
"Returns Report", , emailaddr, , , "Report One", , False
End If

End Sub

I assume it's a different report for each condition, so I would recommend to keep it separate.

Not sure if this is what you are looking for, but, either way, the "SendObject" command is what you would use to send files via e-mail.

comteck
Jul 29 '06 #5
Thank you so much. I have not tried it yet. I will be doing that on monday and I will let you know. I have one more question, my database will be used daily. Is there anyway, sending hypertension status of all the patient on the day they were entered not all of the previously entered patient's status?
Jul 30 '06 #6
I am needing to do something very similar. However,...When a particular Cells data is = -1 then I need to send that contacts data as an E-mail TEXT with the labels such as....

First_Name: John
Last_Name: Smith
Address: 12345 TBD

and so forth
NOT as a TEXT FILE attatchment but as TEXT in the email body...

BTW the table needs to be auto updated about every 5-10 minutes....

then when that particular cell is = -1 then that triggers the email event...

ThX
Aug 1 '06 #7
Hi I need help in similar way
I need daily auto e mail of some report (except Sunday)
How can I write this code
Thanks in advance


Ok, you should be able to modify this code to make it fit your application. For example, for the hypertension, you can use the "LostFocus" for a textbox with a name of, say, "txtCondition". The code would be as follows:

Private Sub txtCondition_LostFocus()
Dim emailaddr As String
emailaddr = Me.txtEmailAddr

If Me.txtCondition = "hypertension" Then
DoCmd.SendObject acSendReport, _
"Report1", , emailaddr, , , "Report One", , False
End If

End Sub

You can then do the same for the blood pressure textbox.

If you wanted to check either one or the other on the same form, then you can use the OnClose event procedure for the form:

Private Sub Form_Close()
Dim emailaddr As String
emailaddr = Me.txtEmailAddr

If Me.txtCondition = "hypertension" Or Me.txtBloodPressure > 140 Then
DoCmd.SendObject acSendReport, _
"Returns Report", , emailaddr, , , "Report One", , False
End If

End Sub

I assume it's a different report for each condition, so I would recommend to keep it separate.

Not sure if this is what you are looking for, but, either way, the "SendObject" command is what you would use to send files via e-mail.

comteck
Apr 17 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
2
by: Tom | last post by:
I am trying to store information into a table that has an auto increment field. There is currently no data in the table. Using the code below I cannot insert data into the table. I get an error...
6
by: Eduardo Rosa | last post by:
Somebody knows how I queue email using .Net? thanks a lot
13
by: Matik | last post by:
Hello everybody, First: SQL Server 2000 sp3a, HP cluster server, MS 2003 server, database recovery model simple Torn page detection: When I have this option turned on, processes conected with...
2
by: SharpSmith | last post by:
hi all i have a very specific question regarding emails sending and googling doesn't help me is a way exists to send email using .NET framework (System.Web.Mail or something else) and have the...
13
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when...
9
by: Beowulf | last post by:
I was having this problem: http://groups.google.com/group/microsoft.public.sqlserver.server/msg/e36e423972323378?dmode=source with it taking an inordinate amount of time to enumerate the...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
2
by: martin DH | last post by:
Hello all, I'm looking to send an email message from my database at the "click of a button." I've got that part worked out - the only thing is, it sends text only and I would like the message to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.