473,387 Members | 1,721 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,387 software developers and data experts.

Automatic alarms for upcoming events

I have been trying to automate certain steps in this database for a company I am working with. I would like to have a query or report run automatically at startup showing all the records that have a due date (the date when people are supposed to pay) of a week from the current date so I can see which orders have a payment due date that is near to come. This date is a field in the orders table. I don´t know if anyone could help me with this, I don´t really know how to tackle this situation. The idea is to have an automatic reminder of which clients have to pay in the following week each time you open the file.

If anyone has any advice, or maybe a complete different idea for completing this task I would be really grateful.

Thanks in advance,
Jul 17 '08 #1
6 2208
janders468
112 Expert 100+
I am assuming the hang up is how to fire the query or report on startup and not how to design the query or report. You can do this in two ways. You can create a macro titled AutoExec and have it run your query or report, or you can go to tools..Startup select a form to open on startup and in that form's open event you can have it run the query or report.
Jul 17 '08 #2
You can follow the following steps in order to fix your problem

1) Write a query that will return the desire result
2) Create a report and set it recordsource to query (of step 1)
3) Create a macro and name it "autoexec". In this macor Selct "openReport" as the action and select report name ( of step 3)

Please write back if you have any question.
Jul 17 '08 #3
Thanks a lot to both of you guys, the AutoExec worked perfecty to run the query at startup, so that is fixed. However, I´m still having trouble with finding the records with a date that is within now and a week from now. I tried using DateAdd("d",7,Date()) but that gave all the records with the date seven days from now and only that day. How can I make the query get me all the records with the date between today and 7 days from today??

once again, thanks a lot
Jul 18 '08 #4
I think I managed to do what I was asking for in the last post..

In the query´s date field I put a filter like this: Between Date() And DateAdd("d",7,Date()) and I think it worked...

Now I just want the AutoExec macro to open the report at startup ONLY if the query has results. Sometimes there won´t be any orders that will expire in the following week so the query will have no results, and I would like the AutoExec not to open the report if this is the case.

Thanks, if anyone can give a little advice
Jul 18 '08 #5
janders468
112 Expert 100+
Before I begin I would say that you should put all of this in a vba function and just have the AutoExec macro run that function using runcode (you have to use a function a sub won't work for runcode). You could make another query that has a single value which is the count of records in your other query. There are many ways you could extract that result, you could throw it into a recordset or use a dlookup, I'd be happy to expound further if you need help on either of those. In your code you could then have an if statement that checks if the value is greater than 0, if it is run the query, if not exit the function and resume the normal startup.
Jul 18 '08 #6
nico5038
3,080 Expert 2GB
For having the data from the last seven days you'll have to use:
Expand|Select|Wrap|Line Numbers
  1. DateAdd("d",-7,Date()) 
  2.  
See the "-" I added :-)

Personally I prefer to use the short version:
Expand|Select|Wrap|Line Numbers
  1. WHERE dtDatefield between Date() and Date() - 7
  2.  
as it performs faster as the DateAdd function.

I would also switch from using a query at startup into showing a mainform with a datasheet subform based on the query. Thus the user can see the result and print a report, but also continue to another form when no report is needed.

Nic;o)
Jul 19 '08 #7

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

Similar topics

2
by: David Burstin | last post by:
Whenever I run VS.NET 2003, my CPU usage sits on 100%, with total memory usage at 330MB. The CPU stays at 100%, even before any projects are opened (on the start page) and for the rest of the...
1
by: raqfg | last post by:
Hi. I am trying to test out the automatic maintanance with notification feature of DB2 v8.2. I have enabled the auto maint with notification. The problem I am facing is that I only get email...
0
by: Nick White [MSFT] | last post by:
Hello fellow Microsoft Windows Mobile and Embedded enthusiasts: I invite you to peruse the list below of upcoming technical chats and Webcasts offered by the Windows Mobile and Embedded Devices...
0
by: Nick White [MSFT] | last post by:
Hello fellow Windows Mobile and Embedded enthusiasts: Allow me to direct your attention to the list below of upcoming Windows Mobile and Embedded product chats and Webcasts. I invite you to...
7
by: Johann Blake | last post by:
It would be nice to have Visual Studio .NET automatically break into the code whenever an event is generated without having to explicity set a breakpoint. It often happens that when a piece of code...
4
by: Bob | last post by:
Is there a way to turn off the form designer's automatic deletion of "handles <control>.<eventname>" when you delete a control? It's extremely annoying to replace one control with another of the...
30
by: Bruce Momjian | last post by:
I have events in the next few weeks in New York City, Copenhagen, Paris, and Atlanta. Check the News section on the web site for more information. I will also be in Amsterdam February 2-3, though...
26
by: Yeah | last post by:
I have a web site which changes the header logo based on the upcoming holiday. For example, from December 10th to 25th, XMAS.JPG is displayed. From October 20th to 31st, HALLWEEN.JPG is...
2
by: romeorion | last post by:
Anyone know how to make a java news tool that would show current and upcoming events on a home page?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.