473,769 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP WITH AUTO EXE PROGRAMMING/CODE

Hey guys,

Forgive me if my question my be alittle silly, but I would very much
appreciate and assistance that could be given!

My situation is as follows:

I have created a Button, and set it's "On Click" Event proceedure to
Loop through my Database and find any records that fall within a
Certain Date...if a record is found...it then emails me that a record
has been found and tells me to check the Database....

Now....I would like to fully automate this process...as the database is
not always used...on a daily basis or even on a weekly basis..... and I
would therefore like to ensure that this process is at least performed
on a weekly basis, is there some manner in which I can achieve
this.....please advise!

I understand that I can set-up and auto-exe process to open the
database...but how can I programme the database to "run" the on click
event proceedure that contains this code...do I have to set it as a
moduel...and create a macro to run when the database is executed or
what?

Jun 14 '06
17 3418
Li****@awamarin e.com.au wrote in
news:11******** **************@ u72g2000cwu.goo glegroups.com:
Also...if you have any idea...I'm going to guess not....no one has
been able to provide assistance as yet


You've been given the answer, but you appear to lack the knowledge
and experience to understand it.

That is not the fault of the people giving you the answer.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 14 '06 #11
Apologies GENTLEMEN....th at sentence has been taken completely out of
context...I do apologize....an d yes you are very correct, I do lack the
experience and knowledge....an d I am ALWAYS very grateful for the
assistance I am provided by very kind people,such as yourselves, who
spare their time to answer and help me with my questions, however, I do
sometimes get a little bit frustrated, so please do not take it
personally, once again thankyou for taking the time to answer my
threads!

Kind Regards,

Liam

David W. Fenton wrote:
Li****@awamarin e.com.au wrote in
news:11******** **************@ u72g2000cwu.goo glegroups.com:
Also...if you have any idea...I'm going to guess not....no one has
been able to provide assistance as yet


You've been given the answer, but you appear to lack the knowledge
and experience to understand it.

That is not the fault of the people giving you the answer.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/


Jun 14 '06 #12
passing data to a subroutine...

I modified Danny Lesandrini's code a little.... I should probably have
declared the arguments as variants so I could pass a null value, but
anyway...

query:

SELECT ShipsInformatio n.[SBMA Number], ShipsInformatio n.[Vessel Name],
ShipsInformatio n.[IMO Number], ShipsInformatio n.[Date of Issue],
ShipsInformatio n.RecordID, ShipsInformatio n.[Date of Attendance],
DateAdd("yyyy", 1,ShipsInformat ion.[Date of Issue]) AS [Due Date],
ShipsInformatio n.EmailAddress
FROM ShipsInformatio n;

Personally, I would modify the SQL statement to filter out all the
records I am not interested in.

IOW, add a valid WHERE clause to your query...

SELECT...
FROM...
WHERE DueDate <=DateAdd(Date, "d",-5)

(all DueDates that fall within the next five days).

Then you would do something like

'===I stole this in its entirety from Danny's website. (cited
previously)
' and then modified it, so if it doens't work, that's my doing.

' Next function reads user entered values and
' actually sends the message

Public Function SendMessage(byv al strRecip As String, _
byval strSubject As String, _
byval strMsg As String, _
byval strAttachment As String) As Boolean

On Error Resume Next

If Len(strRecip) = 0 Then
strMsg = "You must provide a recipient."
MsgBox strMsg, vbExclamation, "Error"
Exit Function
End If
' Assume success
fSuccess = True

If GetOutlook Then
Set mItem = mOutlookApp.Cre ateItem(olMailI tem)
mItem.Recipient s.Add strRecip
mItem.Subject = strSubject
mItem.Body = strMsg

If Len(strAttachme nt) > 0 Then
mItem.Attachmen ts.Add strAttachment
End If

mItem.Save
mItem.Send
End If

If Err.Number > 0 Then fSuccess = False
SendMessage = fSuccess

End Function
sample call:
blnSuccess=Send Message("jd**@a bc.com", "subject: notification", _
"Your membership is about to expire!",
"C:\somefolder\ reminder.doc")

so assuming you wanted this done without opening a form at all, you
could do something like this:

Public Sub SendNotificatio ns()
dim rs as dao.recordset
dim qdf as dao.querydef

set rs=dbengine(0)( 0).openquerydef ("qryNotificati ons")
do until rs.EOF
rs.Edit
blnSuccess=Send Message("jd**@a bc.com", "subject: notification", _
"Your membership is about to expire!",
"C:\somefolder\ reminder.doc")

rs.Fields("Mess ageDatestamp")= Now()
rs.Update
rs.MoveNext

loop

rs.close
set rs=nothing

end sub

Jun 15 '06 #13
Thankyou so much for your assitance/ reply....very much appreciated...I
have taken your advice and constructed a new Query, which only shows
the records I am interested in (and thus excludes all of the
others)...there fore this query only shows the records that are due
within the next two months...I fine tuned the code, through the very
professional assistance of John Vinson:

WHERE ShipsInformatio n.[Date of Issue] Between DateAdd("m",-12,Date())
And DateAdd("m",-10,Date());

I have a few questions regarding your automation of the email
process...if you could spare the time to help me further...it would be
very much appreciated:

Now that I have created this separate Query that only shows the records
I want....I now no longer need to loop through the records to see if
they fit within a certain criteria, do I? All I need to do now is send
an email to ALL the records in this query...

THe easiest manner in which to do this I assume...would be an onload
event proceedure that emails to all the record shown in the query....
How do I command the database to do this...loop through all of these
records?
And How can I pass the Fields into the body of the email...i.e details
pertaining to that particular record?

Please forgive me...as I am relatively new to all of this...so any
assistance provided would be much appreciated.... .

Kind Regards,

Liam

Jun 19 '06 #14
I answered this in my response to your other post... basically, you
open a recordset based on the query (instead of the table) and then
loop through them and process.

Essentially, I created a function to collect the values from the query
into a single delimited string. then I just assigned the result of
that function to the .Body property of the message. (So the function
just does the "collecting " of records, and then your message routine
just deals with the sending the message.

Now that I have created this separate Query that only shows the records
I want....I now no longer need to loop through the records to see if
they fit within a certain criteria, do I? All I need to do now is send
an email to ALL the records in this query...
I'm confused. I thought you were mailing them to yourself... at any
rate, you'd loop through the recordset, grab the individual e-mail
address, and pass that to your SendEmail function.
THe easiest manner in which to do this I assume...would be an onload
event proceedure that emails to all the record shown in the query....
How do I command the database to do this...loop through all of these
records?
And How can I pass the Fields into the body of the email...i.e details
pertaining to that particular record?

Please forgive me...as I am relatively new to all of this...so any
assistance provided would be much appreciated.... .

Kind Regards,

Liam


I think I answered the rest of this in the other message. Just for
clarification. Are you:
A. Sending the SAME message to all the recipients (in which case you
can BCC them all).
OR
B. Sending a *custom* message to each recipient
?

The difference is small, but significant, because in the first case,
you create the message once, and in the second once *for each record*
(inside a loop)

hope this helps,

Pieter

Jun 19 '06 #15
Hey Pieter,

thankyou so much for your reply...your answers are always very
enlightening and helpful...and more importantly helping me move closer
and closer to finishing this project...yay!

I would like to be able to customize each email to these
records....plea se note, however, that these emails are only being sent
to MYSELF as reminders, not different recipients for each
records...just to myslef...howeve r, for each email I would like to be
able to specifically mention which record it is that I am being
reminded about....I would like it to be able to pass, for example,
three to four fields from each of the records into Body of the
email....(i.e the "Vessel Name", the "IMO Number", the "Date of Issue"
and Perhaps the "Short Description") fields....

Kind Regards,

Liam.

Jun 20 '06 #16
If the table is not automatically updated by say an instrument passing on
readings, which I don't believe it is since it is about ships, then someONE
has to update it.
If that is the case then you don't have to "run" it unattended. Get the db
to send the email everytime the table gets changed. Put the code/macro that
checks the table in an event (such as Afterupdate of the last field) in the
data input form!

Li****@awamarin e.com.au wrote:
Hey guys,

Forgive me if my question my be alittle silly, but I would very much
appreciate and assistance that could be given!

My situation is as follows:

I have created a Button, and set it's "On Click" Event proceedure to
Loop through my Database and find any records that fall within a
Certain Date...if a record is found...it then emails me that a record
has been found and tells me to check the Database....

Now....I would like to fully automate this process...as the database is
not always used...on a daily basis or even on a weekly basis..... and I
would therefore like to ensure that this process is at least performed
on a weekly basis, is there some manner in which I can achieve
this.....pleas e advise!

I understand that I can set-up and auto-exe process to open the
database...b ut how can I programme the database to "run" the on click
event proceedure that contains this code...do I have to set it as a
moduel...and create a macro to run when the database is executed or
what?


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 20 '06 #17

Li****@awamarin e.com.au wrote:
Hey Pieter,

thankyou so much for your reply...your answers are always very
enlightening and helpful...and more importantly helping me move closer
and closer to finishing this project...yay!

I would like to be able to customize each email to these
records....plea se note, however, that these emails are only being sent
to MYSELF as reminders, not different recipients for each
records...just to myslef...howeve r, for each email I would like to be
able to specifically mention which record it is that I am being
reminded about....I would like it to be able to pass, for example,
three to four fields from each of the records into Body of the
email....(i.e the "Vessel Name", the "IMO Number", the "Date of Issue"
and Perhaps the "Short Description") fields....

Kind Regards,

Liam.


If you want one e-mail per record, you would put the
SendObject/SendEMail (whatever your routine is to send the e-mail)
*inside* the loop. (I was wondering about that!!!)

If you want to customize for each e-mail, you would build the body of
the e-mail inside the loop that walks the recordset.

Something along these lines:

Say your query is called qryReminders
const strEMAIL = "my*****@myISP. com"

dim rsReminders as dao.recordset
dim strMsg as string

set rsReminders =dbengine(0)(0) .OpenQuerydef(" qryDueEmails")

do until rsReminders.EOF '---loop thru entire recordset

strMsg="Somethi ng due on " &
rsReminders.Fie lds("SomeDateFi eld") & vbcrlf &
rsReminders.Fie lds("SomeName")
olkMsg.Recipien t = strEMAIL
olkMsg.Body = strMsg
....
olkMsg.Send
rsReminders.Mov eNext

loop
<other code to clean up etc>
I hope this is clear. No, it's not complete code. But the general
idea is this.
1. open the recordset of "due e-mails" based on some query.
2. loop through the recordset and do something with the individual
record
3. close the recordset, and clean up <set refs to Nothing, etc>

Here's a really simple example of looping through the query results in
code:

Public Sub LoopThruQdf(ByV al strQuery As String)
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset

Set qdf = DBEngine(0)(0). QueryDefs(strQu ery)
Set rst = qdf.OpenRecords et
Do Until rst.EOF
'===You'd put your e-mailing code here.
Debug.Print rst.Fields(0)
rst.MoveNext
Loop

rst.Close
Set rst = Nothing
Set qdf = Nothing
End Sub

Jun 24 '06 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2215
by: python-help-bounces | last post by:
Your message for python-help@python.org, the Python programming language assistance line, has been received and is being delivered. This automated response is sent to those of you new to python-help, to point out a few resources that can help with answering your own questions, or improve the chances of getting a useful answer from the helpers. The most comprehensive overview of python.org help resources is at ...
19
14850
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2 scsi disks installed on the db box. Sqlserver is set to use max 1,4 GB RAM, and the sqlserver does not seem to be using it all.
28
14259
by: PerryC | last post by:
Anyone know how to auto close the parent / opener window without confirmation? I have tried: <script> opener.window.close() </script> ----I put it in the child html page, and nothing happen!!---
10
2265
by: Rohit | last post by:
I need some ideas on how to write a program that could -- Read an MS Access database and grab information say Vehicle year, vehicle make -- Make a call to a website and enter the information grabbed earlier -- Get the Auto premium quote -- Store the results on the MS Access database / table. The Websites that quote premium on web like progressive's website use POST method to pass information from one URL to another. For example,
4
2850
by: Web_PDE_Eric | last post by:
I don't know where to go, or what to buy, so plz re-direct me if I'm in the wrong place. I want to do high performance integration of partial differential eqns in n dimensions (n=0,1,2,3..etc) I want to do (fast) graphic output of the results. I used to use C. I want to upgrade my computer. Do I get dual core? Does C# support dual-core? Is C# as fast as the old C? Is there a new C? (or is C# the new version of C?) Is Visual Studio...
0
5575
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
2797
by: Webstorm | last post by:
Hi, I hope someone can help me sort this out a bit, Im completely lost. Here is the page I am working on: http://www.knzbusinessbrokers.com/default.asp I have 3 search critera that I need to use when querying the database. Right now it is only looking for a match on one of those dropdowns and not all 3. can anyone help? Here is the code: <form BOTID="0" METHOD="POST" action="businessforsale_interface/Results/test3.asp">
10
1607
by: Jonathan Wood | last post by:
I'm taking my first stab at using ASP.NET memberships and could use some help. I'm following along in a book, which recommends I use the Web Application Administration Tool in VS 2005. A couple of problems: 1. The only choices it gives me for the authentication method are Windows and Passport. Based on what I read, forms is what I need. Can anyone tell me
21
6354
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.