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.
7 8123
Try "SendObject" under macros.
comteck
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
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.
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
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?
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
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
by: Eduardo Rosa |
last post by:
Somebody knows how I queue email using .Net?
thanks a lot
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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....
|
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
| |