Queries :: Expiration Date - Older Than/ New Than With Dates

Nov 27, 2013

I've built an an update query that updates a Yes/No field "Expired?" to "Yes" if the expiration date has passed i.e. if the current date is newer than the expiration date. I thought this would translate into the current date being greater than the expiration date?

UPDATE Alert
SET Alert.[Expired?] = 'Yes'
WHERE Alert.Current_Date>Alert.Expiration_Date;

When I run this, it identifies the records to be updated, but then stops updating the fields due to "a conversion failure."

View Replies


ADVERTISEMENT

Queries :: Display Expiration Dates For Next 30 Days

Nov 13, 2014

My database keeps track of training for employees, some of which expires after a period of time, which is in the tables. I need to create a query that displays only the employees and the training that expires during the next 30 days. I have a query that displays the expiration date (this field uses DateAdd and adds the expiration term to the date the employee completed the training) I am trying to add a criteria to this field. I found <=Date()+30 in my searches but that displays all of the records from 12/14 and back. I have tried all kinds of versions of this (obviously, not the correct one) and either get all records or none. (Yes there are records in the database that fall within the the period I am trying to display - that is something that I have been known to forget)

Is it because I am using criteria in a field that is based on DateAdd or what would be the correct criteria for this?

View 3 Replies View Related

Queries :: IIF Statement To Calculate Expiration Dates Within Query

Jun 15, 2015

I'm trying to build a query with an iif statement to calculate expiration dates within a query. For some reason what i'm trying to do is not working as expected.

Here's the situation. Every employees with an exception of two employees in the company has an expiration 2 years after the class took place. The two exceptions are the certified instructors who's training certification is good for three years.

I've created a query with the employeeid, training subject, and maxoftraining date.

I'm trying to write an if statement to give me the expiration date based on the above information. Here's what I have so far; however its not calculating based on the criteria.

Expiration: IIf([tblemployee]![EmpID]=1 Or 2,DateAdd("yyyy",3,[maxoftrainingdate]),DateAdd("yyyy",2,[maxoftrainingdate]))

At this point in time, all "expiration" dates are showing + 3 years rather than just the Employee ID's 1 and 2 and the rest +2 years.

View 2 Replies View Related

Queries :: Set Up Query Which Responds And Filters By Date (Older Than X Date)

Jul 11, 2014

I currently have a query set up which responds and filters by the date.

I use the current code in the criteria on the query for todays date less 7 days

Code:
DateAdd("d",-7,Date())

This works perfectly and I had no problem with it. However I need to adjust the criteria so it is less than 7days ago OR OLDER....

How would I go about doing that?

View 4 Replies View Related

Queries :: Show Data Older Than Specified Number Of Years From Future Date

Apr 22, 2014

Querying a field for a number of days from today's date but not had a lot of luck finding how to query this from a date in the future.

Currently I have as criteria for the relevant field:

Code:
<[Period Start (dd/mm/yy - less 5 years from financial year end)]

which prompts for a parameter but using this I have to figure out the date 5 years from the future date first and then enter this.

Surely there must be code that allows me to simply enter the date, in the prompt and this then shows me data of 5 years or older equipment!?

View 8 Replies View Related

Creating Database To Manage Expiration Dates Of Medications

May 6, 2014

I am trying to create a database to analyze expiration dates of multiple products.

Let me lay out what I am trying to accomplish.

I have 5 ambulances, each ambulance has the same quantity of medications on it. There are three separate locations medications are stored on each truck. Each month I need to be able to update expiration dates, query what medications will expire by a set date and where exactly they are located.

SO here is the structure as I see it.

Ambulance 1 contains, a drug drawer with approximately 30 different medications, a trauma bag with about 10 different medications, and a blood glucose kit with 2 different medications. Now some of medications are repeated in the different locations, but have different quantities. The medications will never all have the same expiration date, and medication 1 might have 8 vials, where medication 2 may have 4 vials. I would like my form to be dynamic based on the inventory level of the medications. That way if we decide to keep 10 vials instead of 8 the form will then require the 2 extra data points.

The tables I have created so far...

table 1 lists all the ambulances
table 2 lists medications in the drug drawer and the inventory level
table 3 lists medications in the trauma bag and the inventory level
table 4 lists medications in the blood glucose kit and the inventory level

I need to create a table to store my expiration dates for each of the locations in each of the ambulances.

I need to create a form to simplify the entry of the data into those tables and I want the form and table to be dynamic to the inventory level.

View 3 Replies View Related

MS Access Query Help. Expression For Calculating Multiple Expiration Dates.

Feb 28, 2008

Hi everyone
I'm a very very new access user so many apologies in advance for when I have no idea what I"m talking about.

I'm working on creating a report that will display multiple expiration dates. Currently I have an employee database, not created by me, that has all of our employees professional licenses listed.

Prof license, auto license, liability, etc.

I want to create a report that will tell me what has already expired or will expire in the next 30 days.

I did use this
Between DateAdd("d",-30,Date()) and Date() and it is bringing back info up to 2009. which isn't what I need. I'm sure I'm doing something wrong here.

I want anything that has expired regardless of the date from today, before today, and 30 days from today but I don't care about anything more than 30 days from today's date.

I noticed that when I looked at the existing database that the fields are set as text fields. I tried to change them to dates and it gave me a "deleting 106" records error message. Yikes!

Any help would be appreciated. I don't really understand expressions and I don't understand if I'm supposed to put the actual date in parentheses or what. Please pardon my ignorance.

Many many thanks.

View 14 Replies View Related

Reports :: Count Column Of Dates Older Than A Year

Aug 21, 2013

So I have a report generated, listing all my companies personnel in one column and the next column has the expiration dates of a certian training certificate. My question i would like to add some statistics to the bottom of the report, mainly how many certificates are expired, which is the ones over a year.

I have attempted to use:

=Sum(IIf([AT_LEVEL 1]<"Now()-365",1,0))

previously in excel my spreadsheet counted it like this:

=COUNTIF(C5:C77,"<"&TODAY()-365)

View 3 Replies View Related

Automating Expiration Date (and A Few Other Things)

Aug 6, 2007

Good morning to everyone.
I am hoping that you will be able to help me with a table that I am working on. I have almost no experience with access, so I am useless when it comes to this.

I have attached a condensed version of the database that I am working on (removed everything except the one table that I am working on) so that you can see and edit what I am working on.

The requirements are simply this.
-If "Status" = 'new inquiry' and has not been update in 6 months, automatically changes to 'inactive' and "probability of order" automatically changes to 0%

-"Initial Inquiry Date" is set to the date the Inquiry was added to the table (but user has ability to change it manually)

-*bonus* If ship quarter has passed todays quarter then change "Status" to 'inactive'.

I hope I have attached enough for everyone to be able to help.
Thank you very much in advance, I really appreciate it. :)

View 14 Replies View Related

Automatically Populate Expiration Date

Jan 10, 2014

I have a form with a date of when training was completed. I would like to set it up so it displays the date of expiration which is one year from when the training was complete.

View 2 Replies View Related

Expiration Date Field Update Thingy

Feb 9, 2005

Hello everyone.. I'm new :).

I'm working on a school database project and I am developing a Gym subscription/registration system.

Basically, once a user enters his/her personal info, they are taken to a second form where they can enter the subscription plan type (there are three plans).

Now, this is what I'm stuck on.. When a user enters a subscription start_date, I want the next field 'Exp._Date' to update to a year later, automatically.

So for example, if you enter 09/02/2005 in the start_date field, then the next field would automatically be filled with 09/02/2006.

Is it possible? And more importantly, how? I'm fairly new to DB's so please lay it in laymens ;).

Thanks guys.

PS: A screenshot of the form is located below:
http://img226.exs.cx/img226/9293/dbsc3xi.th.gif (http://img226.exs.cx/my.php?loc=img226&image=dbsc3xi.gif)

View 11 Replies View Related

IIF Statement Expiration Date Not Excluding NULL

Oct 8, 2013

I have this IIF statement however all empty cells are also coming up as Expired. How do I exclude empty cells?

Status: IIf([Expiration Date]>= Date() ,"CURRENT"," EXPIRED")

View 4 Replies View Related

LATEST Date Older Than 45 Days....

Mar 21, 2008

I need to find the LATEST date in field Recdate that is 45 days or older in a query. I have tried <Date()-45, etc. but it returns all dates not just the last one. Does this require a range of dates to do this ? If not, how would I id the last date input ?
Thanks

View 14 Replies View Related

Queries :: Unable To Open Or Design Queries From Older Access Files

Jan 1, 2014

Im trying to work on an db in Access 2007 that was migrated from Access 2003 (in fact its been migrated several times starting from Access 97). It executes and runs with no problems in both versions.
The problem is when trying to open some queries (not all) - Access is unable to open the query in design mode and gives me this error :

" is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.

However, as I cant open it - I cant check it. Im pretty sure none of the fields have invalid characters (they do have spaces) and Im not sure how long is too long....

View 6 Replies View Related

Queries :: Not Display Any Records Older Than 3 Hours

Jun 26, 2014

How to build a query in Access 2010/13 that will not display any records that are older than 3 hours? See below for more specifics.

The criteria would be based on a field that houses the time (End Time) and also a field that houses a number (Status). So, only if the field in the record says 3 (based on the Status field) then it should not display the record after 3 hours (based on the End Time field) of being changed to a 3. Is it possible to do that?

I have attached a screenshot of what I am referring to.

View 5 Replies View Related

Queries :: Update Newer Record With Older Fields

Apr 19, 2014

My table occasionally gets a second record added for the same person. What is the easiest way to update the new record with the non-zero fields from the older record, then delete the older record? There is a unique id field as well as a timestamp, so knowing which is older isn't a problem. Is there an easy way to do this?

View 2 Replies View Related

Queries :: Dates Between First And Last Date

Apr 19, 2013

If i have a table with firstdate and lastdate, then i need a query were i can see all the dates between.

Firstdate: 16/05/2013
Lastdate: 23/05/2013

Need result in query:
16/05/2013
17/05/2013
18/05/2013
19/05/2013
20/05/2013
21/05/2013
22/05/2013
23/05/2013

View 2 Replies View Related

Queries :: See All Dates Between Start And End Date

Apr 22, 2013

I'm booking in my hotel booking system the start and enddate of renting a room.

Example: Room 12 is booked from (startdate) 16/05/2013 till (enddate) 19/05/2013.

Now i need a query where i can see all the dates between start and enddate.

Like:
Room 12 16/05/2013
Room 12 17/05/2013
Room 12 18/05/2013
Room 12 19/05/2013

This between function i really need.

View 1 Replies View Related

Queries :: Using One Date Minus To Other Dates

Jul 8, 2015

I need to create a query that will do the next:

use today's date, minus start date, minus sent to BP, minus response from BP.

The field names are:
Start_Date
Sent_to_BP
Response_from_BP

I also have a holiday table that should be used to have only business days passed (so, not weekends and holidays counting).

View 8 Replies View Related

Queries :: Selecting All Date Fields Between Two Dates?

Jul 31, 2013

I'm trying to select a range of relevant dates for an amortization calculation (see my earlier thread on this subject here), but I'm having a bit of trouble making the SQL work.

I have a table called "t_AllMonths" that has only one field: MonthStartDate which contains the first day of the month for a very wide range of months over something like a ten-year period. I'm calculating amort for assets which will be amortized for some subset of those months (defined by the asset's Amort Start Date and Amort End Date). Further complicating matters, the amortization may be suspended during certain "hiatus" periods when the asset it not planned to be in use, and may differ by which business units make use of the asset.

So, I have three tables.

Table: t_Assets
Fields: AssetID (autonumber; primary key), Asset_Name, Asset_Cost

Table: t_AllMonths
Fields: MonthStartDate

Table: t_AmortPeriods
Fields: AmortPeriodID, AssetID, Amt_Period_Num (which I don't expect to use in this), StartDate and EndDate

Right now, I'm just trying to pull the range of dates between the earliest amort start date and the latest amort end date. (Min of StartDate and Max of EndDate, respectively) for a given AssetID.

My sql looks like this:

SELECT t_AllMonths.MonthStartDate,
Min(t_AmortPeriods.StartDate) AS MinOfStartDate, Max(t_AmortPeriods.EndDate) AS MaxOfEndDate,
t_Assets.AssetID
FROM t_AllMonths,
t_Assets INNER JOIN t_AmortPeriods ON t_Assets.AssetID = t_AmortPeriods.AssetID
WHERE ((t_AllMonths.MonthStartDate) Between [MinOfStartDate] and [MaxOfEndDate]);

I keep getting an error message that reads "Run-Time Error 3122: You tried to execute a query that does not include the specified expression MonthStartDate as part of an aggregate function."

View 5 Replies View Related

Queries :: Querying Dates Between A Start And End Date Field

Aug 25, 2014

I have a db tracking vacation times for staff. One of the fields tracks a members vacation start and end dates. I need a way to pull a report to see who is on vacation based on Date() (today).

For example:

A record for John Doe has him start vacation 08/19/2014 and end vacation on 8/28/2014. If I wanted a report that shows who is on vacation today, 08/25/2014, using the date() function), how would I do this?

View 3 Replies View Related

Queries :: Return Records Between Dates Based On 2 Date Fields In A Table

Apr 24, 2013

I have a table which includes a start date field and completion date field for housebuilding.

I am trying to extract all records that have either a started date or a completed date between 2 dates supplied by the user. I have tried to use Between on both fields but that doesn't return results between the fields.

It workd if I just do it on EITHER the start date field OR the completion date field so that implies to me that I need to break it into 2 queries, one returning start date recrods and the other returning completion date records but then I would need to have somthing that removes records that appear in both the start date and the completion date results.

View 7 Replies View Related

Queries :: Select All Dates Since A Given Date Without Referencing A Table? (Access 2007)

Apr 23, 2014

Is it possible to create a query to select all dates from a given reference date? I don't mean all dates in a table - I mean all dates generally?

(The idea being to fill the first field in the resultant dataset with the list of dates, then run subqueries off that to fill the remaining calculated fields)

I'm currently using a date field in one of my tables to populate this first field (the full SQL is in a separate thread here)

But that was just a convenient way of getting a list of dates; the dates in that table don't actually have any significance to the resulting dataset (other than they should roughly overlap with the dates I'm looking for)

The flaw in that method is that the table from which I get those dates can only ever have dates up to and including yesterday. I also need to get today's date in there (and calculate the subqueries based on that date as well).

It's also possible - although unlikely - that there could be random dates missing from that table as well - in which case I need to plug those gaps and calculate my fields for those missing dates as well.

For clarity; that first field (AsOfDate) should contain every weekday from the earliest date in that table (i.e. Min([tblBalances].[BalanceDate]) up to and including today. It doesn't matter if any of the dates inbetween are missing from tblBalances as the subqueries will just return zeroes for those dates (which is exactly what I want to see).

View 3 Replies View Related

Queries :: WHERE Statement - Enter Dates Into Date Reported Fields For Results To Show

Sep 11, 2013

I use this

'WHERE ((OperationalRiskEventTable.DateReported)>=Forms!U pdateForm!UDateBegin And (OperationalRiskEventTable.DateReported)<=Forms!Up dateForm!UDateEnd)'

in a query by form.

The problem is that you have to enter a date in the between values for results to show. If I don't enter information into a different field such as Full Name but I enter in 40 into Age then everyone that is 40 years old will show. On the other hand if I enter 40 into the Age field but I leave the Date Reported fields empty then no results will show.

How can I change it so that I don't have to enter dates into the date reported fields for results to show?

View 4 Replies View Related

Queries :: Find Latest Date In A Table Where Dates Are In 2 Separate Columns And Multiple Rows

May 19, 2015

I am trying to find the latest date in a table where the dates are in 2 separate columns and multiple rows. (there are business reasons why there are 2 dates per row they represent different but comparable activities)

I have a table "Assessment tracker" with the following structure

Name Type
Candidate short text
Unit short text
EV1 Date Date
EV2 Date Date

My Data:

Candidate Unit EV1Date EV2 Date
TH1 10 07/05/2015 25/05/15
TH1 10 07/05/2015 07/06/15

I have a query "Candidate AC Dates" that compares the 2 dates EV1 and EV2 and outputs a 3rd column with the latest date.

Query:
PARAMETERS [Candidate Name] Value;
SELECT [Assessment Tracker].Candidate, [Assessment Tracker].Unit, [Assessment Tracker].[EV1 Date], [Assessment Tracker].[EV2 Date], Max(MaxDate([Assessment Tracker]![EV1 Date],[Assessment Tracker]![EV2 Date])) AS Achdate
FROM UnitData INNER JOIN [Assessment Tracker] ON UnitData.Unit = [Assessment Tracker].Unit

[Code]....

Output:

CandidateUnitEV1 DateEV2 DateAchdate
TH11007/05/2015 25/05/201525/05/2015
TH11007/05/2015 07/06/201507/06/2015

It does this by using a function shamelessly copied from the web somewhere...

Function Maxdate(ParamArray FieldArray() As Variant)
' Declare the two local variables.
Dim I As Integer
Dim currentVal As Date' Set the variable currentVal equal to the array of values.
currentVal = FieldArray(0)
' Cycle through each value from the row to find the largest.

[Code]....

This is working well (I think)

I then want to find the latest date for the 2 records i.e. the Max value for the Achdate.

Query:
SELECT [Candidate AC Dates].Candidate AS Expr1, [Candidate AC Dates].Unit AS Expr2, Max([Candidate AC Dates].Achdate) AS MaxOfAchdate
FROM [Candidate AC Dates]
GROUP BY [Candidate AC Dates].Candidate, [Candidate AC Dates].Unit
ORDER BY [Candidate AC Dates].Candidate, [Candidate AC Dates].Unit, Max([Candidate AC Dates].Achdate) DESC;

But this is returning

Candidate Unit MaxOfAchdate
TH1 1025/05/2015

I expect it to return

Candidate UnitMaxOfAchdate
TH1 10 07/06/2015

It looks to me like MAX is considering only the day value rather than the whole date. I suspect this is because it is considering the results of the function in the first query as a short text rather than a date field. (I've tried to force this through declaring the variables as dates but don't know where else to force this. (I am UK based hence the DD/MM/YYYY format)

View 14 Replies View Related

Queries :: Calculate Expiry Dates Of Training Courses - Due Dates Not Shown

Aug 28, 2013

I have built a query to calculate the expiry dates of training courses but I am trying to input a criteria so that only dates within 90 days of todays date show. I am using Date()<90 but it doesn't return the correct information. What the criteria should be for this?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved