473,387 Members | 1,572 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.

Looping Query or Constantly running Query in Access

Would it be possible to set up a Query that constantly runs to check for the year? Then when the year changes it would delete data for the previous year.

The big thing is that I want it to keep running and checking.

Thanks
Oct 27 '11 #1
4 2036
Stewart Ross
2,545 Expert Mod 2GB
Access queries cannot be run in the way you ask (asynchronously on a constant basis monitoring for a state change) - but then there is no need to do so. You are only looking for a change of year, so why not set up something which does so when the database is started? If you have a default form that is opened at startup you could use the form's On Load event to run some kind of check and take whatever action is necessary.

I would be cautious about deleting data from the previous year, however. You don't tell us anything about what you are storing or why you need to delete data at end-of-year.

Unless you are dealing with vast amounts of data, don't. Relational databases very rarely require this kind of data removal - for the very good reason that the data stored is a history of the transactions conducted for or about the entities you have stored in the database, and to delete data arbitrarily is to lose information which would be better kept, in my opinion.

-Stewart
Oct 27 '11 #2
Thanks for the reply that was great help. The data I am using is simply a incrementing value linked in with another piece of software. so when a new order is put in it will update. This is so we can see how many orders are put through a year.
Oct 27 '11 #3
NeoPa
32,556 Expert Mod 16PB
Instead of clearing it all down and starting again from scratch you could include the year value in the ID and simply reset the count whenever the year changes (Using Year(Date()) to determine the current year and checking only those existing records which match that year).
Oct 27 '11 #4
Rabbit
12,516 Expert Mod 8TB
How are you going to see how many orders are put through a year if you're deleting all the data each year?

And if all you need is to see how many orders are put through in a year, don't you have an order date field you can use for that?
Oct 27 '11 #5

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

Similar topics

0
by: tukaram.thatikonda | last post by:
Hi Guys, I have written a small windows application in VB.Net to test ADO.Net performance while executing long running query. The query works most of the time but fails sometime. I am trying...
4
by: Kory | last post by:
How do you stop a long running query with a SQLConnection or SQLCommand? Calling Close on either just waits until the query is done. Is there a way to stop it? The following on a long query ...
1
by: jnikle | last post by:
I have a parameter query named "qry_employee_info_reports" that I need to run in the OnOpen event of a form. I'm after its total number of records. The query's got several joins in it, and one of...
6
by: johntarr | last post by:
I hope I am not asking about something that has been done before, but I have searched and cannot find an answer. What I am trying to do is to run a query, and then perform some logic on the...
3
by: Phil Stanton | last post by:
I have a number of queries which use code for the output of 1 or more fields. For example Address:GetAddress(AddressID, True, 60) Address ID Points to an Address in a table - Address Line1, Line...
2
by: k-man | last post by:
Hi: I have an MS Access query for a table called MyTable. One of my fields in the query is a custom field that looks like "MyField: = MyFunction(ID)" where ID is a field in MyTable. I have...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
3
by: robin1983 | last post by:
HI all, how are you ? i need help from you people. This time my problem is that i m running a query inside another query. But, the result that i got is something not exactly what i want. and one...
4
by: Simon | last post by:
If I am running a long time query, how to show a wait page at then? Is there any recommended way to do it? Thanks.
7
ollyb303
by: ollyb303 | last post by:
Hi, I am having a bit of a problem with TransferText macro. I am using TransferText, Export Delimited (no field names) to export the results of a query as a .csv file. The query is based on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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.