Complex Date Criteria

Aug 29, 2006

I have a query which i would want to show records between January 2004 and September 2004, assuming the [Current Month] is October 2005.

The idea is to have a listing of sold policies between the first month of previous year and the month (of previous year) prior to the current month/year.

Here's the criteria i used:
Between DateSerial(Year([Enter: Current Month])-1,2,0) And DateSerial(Year([Enter: Current Month])-1,Month([Enter: Current Month]),0)

The criteria only shows records between July 2004 and September 2004.

How can i show records beginning January 2004?

:confused:

View Replies


ADVERTISEMENT

Complex Expressions Or VBA Functions As Criteria In A Query

Aug 4, 2005

Hi there,

I have a list (listA) which has a record source of a query object (queryA).
The form (formA) which has listA in it, also has a text box for some of the fields requested in queryA. The goal is to provide a flexible filter for the records in the list, so the user can just type in 'K' in text box filter_name, and they will only see records matching the entry.

N0w, the scene is set! I can easily go into the query object, and in criteria type something like this:

Like "*" & [Forms]![formA]![filter_name] & "*"

This works! It flexible filters out the records matching the text box value..
But, if the record has NULL for the name, then it won't even match "**", which is the minimum criteria. So therefore I get exclusion of records, which I dont want.

So I thought perhaps there might be some control structure I can use in expressions... some if, else, end if statement? Does anyone know how to do this?

Alternatively I thought, I could write a function like this..

Function criteria(ByVal val As Variant) As Variant
If (IsNull(val) Or IsEmpty(val) Or val = "") Then
'do nothing
Else
criteria = "Like *" & val & "*"
End If
End Function

And then in the queryA object for criteria you just use:

=criteria(Forms!formA!filter_name)

But this doesn't seem to work.. and I dont know how to debug this...

Any ideas? I thought the function was a neat solution, but it seems not!

Thanks in advance!

Hiero

View 2 Replies View Related

Queries :: Adding Complex Criteria To A Query

Nov 29, 2013

I've got two tables in my Access 2010 database - both are identical in structure, the difference being one (Dove) contains old data and the other (Dove Data File) contains updated data. The primary key for these tables is "TowerBase".

I want to use an update query to update only the changes from the Dove Data File table into the Dove table - but for certain records only.

I've managed so far to get a query which displays only records that have changed in a particular field (Bells). Up to here I think is all good...

SELECT [Dove Data File].*
FROM [Dove Data File] INNER JOIN Dove ON [Dove Data File].TowerBase = Dove.TowerBase
WHERE (((Dove.Inactive)<>True) AND ((Exists (SELECT NULL
FROM Dove
WHERE [Dove Data File].TowerBase = Dove.TowerBase
AND [Dove Data File].Bells <> Dove.Bells))=True));

But now I want to add in criteria and this is the bit I'm struggling with. I need this query to now display only records where there is no associated record in my Visit Dates table. In other words, the Visit Dates table has the "TowerBase" ID along with a visit date. These records I do not want to see in the query, as I don't want to update any changes for these from the Dove Data File table to the Dove table.

View 1 Replies View Related

Complex Date Query (or Is It)

Nov 10, 2005

Hi All

I'm hoping somebody out there might be able to point me in the right direction for solving this problem.

Im developing a hire stock control database and have a table that contains all the order reference numbers and in and out dates.

What i am trying to do is structure a query that searches for all instances of a shipping out/in date that fall within date values already stored in the source table.

e.g. Table values

Out .................In
1/11/05............10/11/05
3/11/05............5/11/05

Query Values

Out..................In
25/10/05............2/11/05

In this instance only the first record in the table should be found.
Many thanks for help in advance

Simon

View 3 Replies View Related

Complex (I Think!!) Date Query

Aug 26, 2006

I have an Access 2002 table with contract_start and contract_end dates, plus annual_payment and payment_frequency (in months i.e. 0 (net 30 days), 3 (quarterly), 6 (half-yearly) and 12 (annually).

I need to extract a query that will tell me when the payments are due by working back to the start_date and calculating if a payment is due in the next, say, 30 days based upon the payment schedule and up to contract_end date.

Contracts can last for five years so the start_date could be up to five years ago.

In this way I can issue a report to identify what invoices need raising for the coming month.

Many thanks :) :confused:

View 3 Replies View Related

Queries :: Complex Join Based On Date Range

Jul 29, 2013

Context is I have a TABLE 1 that has a record for every package shipped with various details about it, include how it shipped, and the date. Table 2 is a key to go from the ship method to a better grouping we deem service level. Table 3 is a Fuel Surcharge (FSC) Table. It includes various FSC % that vary by different service levels and different date ranges. In the end I need to know the amount of pkgs shipped (by month and servicelevel) and the relevant FSC.I have several tables in my database but we should be able to focus on 3 to explain my situation and only the relevant fields:

TABLE 1 (Main Data):
ShipDate
ShipVia

Table 2:
ShipVia
ServiceLevel
FSCType

Table 3:
FSCType
StartDate
EndDate
FSCPercent

DESIRED RESULT:
Month
ServiceLevel
FSCPercent
PkgCount

Table 1 is Left join on Table 2 based on ShipVia
Table 2 is Left join on Table 3 based on FSCType
The issue is Table 3 is dependent on Table1.ShipDate being between the date ranges as well.

There are overlapping date ranges, however they are differentiated by the FSCType field.The only semi-feasible solution I currently have is to expand Table 3 to include every date, and not date ranges. This will create an issue due to size of date ranges etc.

View 8 Replies View Related

User Prompt Date Criteria Not Including End Date

Sep 6, 2007

I have set up a report which prompts the user for a start and end date. However, if they want to run it for a full month they enter eg. 01/07/07 and 1/07/07 - this will not include entries ending on 31/07/07.

Is there a way I can change the criteria prompt so that it read both dates entered as inclusive in the query. I am currently using
Between [enter earliest date:] and [enter latest date:]

View 4 Replies View Related

Hard Code TIME To Selected Date On Form (to Make It Date&time) For My Query Criteria

Aug 17, 2006

Hello buddies :D, do you have any idea how to make this work?

To select data that falls within this criteria of date range between cboDate and cboDate2 (fields on my form). The date in [tblJobDetails]![timeIn] come in this format "08/17/06 10:24 AM", but the cboDate/cboDate2 (takes in date only e.g 08/17/06) what i am after is to evaluate specific hard coded time in addition to the date entered, i.e. even tho, i haven't entered time on the cboDate/cboDate2, I want specific time hard coded where e.g If i select a date range of 08/17/06 and 08/18/06 on my cboDate and cboDate2 it should really be evaluating: 08/17/06 8:00 AM to 08/18/06 8:00 AM.

This is the criteria i curentlly have on my query in design view tha works perfect in selecting date only.
([tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Or [tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Is Null) And ([tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Or [tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Is Null)
How can I incorporate 8:00am to 8:00am into my cboDate and cboDate2. What can i do to make this happen? Your kindness will be greatly appreciated http://www.naijaryders.com/forums/images/smilies/thankyou.gif

View 10 Replies View Related

Date Criteria

Jun 9, 2005

I have this exercise I am doing for access on a sample database. I have already made a table form etc...there is a field with date in the form.. "1/6/2004" for example.
The exercise wants me to set, for example, criteria between two dates. How do I do that?
I used >#1/6/2004# AND <#30/6/2004#

for finding etc betweeen 1/6/2004 and 30/6/2004
but it doesnt work...

What is the correct syntax of this kind of expression?

thanx!

View 2 Replies View Related

Date Criteria

Aug 6, 2006

Good day!

I have a query that filters records which production starts at the first day of the year and ends a day prior to the current month.

I used this criteria:
Between [Enter: First day of the year] And [Enter: Date prior to current month]

I need a criteria which will filter records automatically. I mean, without having to key in required dates.

Thanks a lot in advance.


Sheila

View 9 Replies View Related

Date Criteria

Aug 9, 2006

I'm having some trouble developing a query based on a specific date criteria. I have a date field, called "SurgeryDate" with 4 fields next to it, "3Month", "6Month", "9Month", and "12Month", which are auto calculated with a control source of =DateAdd("y",+90,[SurgeryDate]), based on the date entered in "SurgeryDate". What I would like to do is create a query that, when run, will check each of these 4 fields against TODAY's date, and find any that match today's date, or are 2 days after today. My goal is to build a form off this query that will display the records that match this criteria so that they can be updated. I'm not really sure how to approach this issue. I think the problem I may be running into may be related to the fact that these fields are calculated from a different date. Any suggestions? Thanks.

View 1 Replies View Related

Date Criteria

Oct 5, 2006

hi guys,
I am newbie :) just started learning how to use access a month ago. It may be a simple question to some of you guys, but I am having trouble figuring how to implement this.

So I created a query with a field "AuditDate" I want to audit record every 90 days after "AuditDate". I want like a warning to audit my record after 90days. Maybe Click on something on the form to show a list of record. Do anyone have a simple formula i can use to implement the "auditdate + 90 days"?

I also have a query on other database with a field "TermDate". I want to set a criteria to list all my records 90 days or older from TermDate. Please let me know if theres some simple formula

Thank you very much for your help

E

View 5 Replies View Related

Please Help Me With Date Criteria .....

May 17, 2007

Hi all,
I have a field in my database which shows the last date of review for clients. I have a query from this which shows any reviews which are overdue - they have to be completed every 6 months, so I use

<Date()-180 Or Is Null

The thing is, now we need a query to show clients whose review WILL be overdue in the following month from a date that we enter. e.g, if we enter 1/06/07, we want to see everything that will become overdue in the month of June.

Can anybody help me with the criteria I need to enter in a query to get this result?
Thanks for any help :)
elsiegee

View 1 Replies View Related

Date Criteria

May 17, 2007

Can anyone see a problem with this criteria in my query?
SELECT Orders.[Date requested], Orders.[Item ordered], Orders.[Quantity ordered]
FROM Orders
WHERE (((Orders.[Date requested])>Date()-10))
ORDER BY Orders.[Date requested] DESC;
I get and "Undefined function 'Date' in expression." message. I don't get it! :)

View 3 Replies View Related

Criteria Of A Date

Oct 3, 2006

I need to create a query that only shows items that have a completion date of less than 7 days from the last completion date. i have inspections on vehicle that are due every 7 days but i have noway to tell without going through every one and would like to find out if there is a way to set up a query that takes the difference for the last two entries on on each license plate and if the diffrence is greater than seven then it will show me its last two dates of completion and nothing more.

View 1 Replies View Related

Criteria Issue. Want To Use A Date

May 25, 2005

Hey. Instead of going back every month and changing the date to the first. Is there a function I can put in the Criteria that will automatically filter for stuff only since the begining of the month. Right now I am using this:>=#5/1/2005#. I just want to to automatically change when a new month occurs.

Bowes

View 2 Replies View Related

Date Range Criteria...

Aug 22, 2005

I am wanting to use a query to find dates within a range, like a quarter. Within the criteria I put "[Enter Date:]". I ran the query and tried the "Between..And.." operator and even "<=9/1/05 and >=12/31/05". All I get is an error message saying incorrect syntax or structure. Any questions on how I could set this up so I could perform this search, that would be great.

Thanks. :confused:

View 4 Replies View Related

Query Date Criteria

Oct 3, 2005

Hi,
I have a date field in a query and was wondering if anyone knows how i can
have a prompt to choose between two dates.

Thanks
Alex

View 11 Replies View Related

Date & Time Criteria

Dec 27, 2005

Hi Guys,

Does anyone know how to write the criteria which includes both the date and time. for example, I want it to be the system's date and my specified date. e.g. (date() 14:00:00)

What will be the correct syntax?

Thx!!!:D

View 2 Replies View Related

Calculation Criteria On Max(date)

Jan 16, 2006

My query selects all those who donated to a fund.The max on the date restricts all but their last donation, working fine.But now I want to list all those who have not donated anything in the last x days (user defined). I want to use Date()- dateField>30 but now it does not let me peform the query.
Any way I can do this in just one query? Thanks!

SELECT main.dgTitle, main.dgInit, main.dgSurname, main.dgNo, main.dgStreet, main.dgShul, Max(main.dgDate) AS maxdate
FROM main
WHERE (((Date()-[main].[dgdate])>30))
GROUP BY main.dgTitle, main.dgInit, main.dgSurname, main.dgNo, main.dgStreet, main.dgShul;

View 4 Replies View Related

Date Criteria In A Query

Jun 26, 2006

Wonder if anyone can help with the syntax in this query? It always returns no results and I can't for the life of me understand why.

SELECT tblExpectedShipments.ShipmentDate
FROM tblExpectedShipments
WHERE (((tblExpectedShipments.ShipmentDate)=IIf([Forms]![frmSelectShipperReport]![chkOverdue]=0,(tblExpectedShipments.ShipmentDate)>Date(),(tblExpectedShipments.ShipmentDate)<Date())));


Any pointers would be greatly appreciated. Thanks.

View 3 Replies View Related

Date Criteria As NULL

Aug 16, 2006

I have a form with two controls: DateFrom & DateToI want to filter based on those criteria but when the criteria is ommitted (NULL) I want to display all.In case of other controls I have an SQL as follows:... WHERE (tblClassesOffered.Course = Forms!frmClassReport.class Or Forms!frmClassReport.class Is Null)But with the dates controls the best I could come up with is:...Between IIf(IsNull([Forms]![frmClassReport].[DateFrom]),#1/1/1900#,[Forms]![frmClassReport].[DateFrom]) And IIf(IsNull([Forms]![frmClassReport].[DateTo]),#1/1/3000#,[Forms]![frmClassReport].[DateTo]) Or Is NullHowever that solution is kind of ugly becasue instead of wild cards (I couldn't make them work) I'm using those made up dates and I also wish not to use the IIF if possible (like the first statement).

View 2 Replies View Related

Date And Time Criteria

Dec 28, 2006

I'm trying to build a query for a customer that will automatically run without making them enter a date and time.
Between [Enter Start Date] And [Enter End Date]
Is there a way to make a query auto run a date and time with out entering a date and time?

Thank you

View 6 Replies View Related

Date Criteria With Total Row?

Oct 22, 2007

I have a query with a Total Row and I want it to do its thing only on a specified date range. I have no problem getting date ranges to work in the Criteria section for Select Queries but am now trying it on this calculated query and it is not working. Is it possible to filter using Criteria when you are also using the Total Row? See the attached picture for the simple date criteria I am using that is having no effect at all on the results.

thanks.

View 11 Replies View Related

Date Criteria Question

Jan 3, 2005

I have a table that has a field named interaction date. I am trying to write a query that shows all records that have an interaction date of up to and including todays date. Is there a criteria that i can enter that would allow for the query to pull todays date, so that with every day, the criteria would actually update itself?? Or do i have to hard code in todays date every morning when i run the query??

Again, thanks for any and all help

View 1 Replies View Related

Name And Date With Conflicting Criteria

Oct 9, 2013

I am working on an older database that was built on the 2002/2003 version of Access. When we converted to 2007/2010 Access we lost a small function of the database and cannot find a way to override it. We have a report that prints all names with a summary of hours by the quarter. The database retains all data. After conversion the report will not print all names, only those that were in the database prior to conversion and those with hours in the current quarter. Is there a way to write a multiple set of criteria that will allow the names and the dates to function separately?

View 13 Replies View Related







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