I have a table that has entries recorded with date and time in one field, and I want to have a query that returns all records of a specified date or date range, regardless of the time in the field.
I have tried
Code: Between [StartDate:] And [EndDate:]
And
Code: Between [StartDate:] & "00:00" And [EndDate:] & "23:59"
Access version: 2013 / The user can click a button on the report that opens a form where they can select various filters. Once the user has selected the filters and clicks done, I have some VB code that fires which builds an SQL string with all of the filters selected. It then reopens the report with the new filter.
What I am running into issues with is one specific filter that the user can select. They can select a "from date" and "to date". Sometimes this filter returns what I want and sometimes it doesn't.
For example. I set 01/01/14 as the start date and end date as 15/01/14. <-- this works as desired.But if I put start date as 10/12/13 and end date 15/01/14 for example then it returns all previous records up to the specified end date. I.E dates such as 10/10/13 will show.
This is the VB code used to build the SQL for this filter:
I'm trying to produce a query that shows all records of patients that have a 'non-active' status (stored in the 'Patient Details' table) and haven't had any deliveries after 31/10/2011 (date stored in the 'Deliveries' table). I've tried a few different ways including using NOT IN (which access didn't like!) but I'm still no closer to getting the correct records.
I am trying to create a simple database to keep track of employee Car Insurances and MOT information.I am trying to create a query that will show me the following:
When the field "motexpiry" is Empty OR has a date within 30 days from todays date (including if today's date is in the field) OR the date is in the past.It also needs to show records with the same criteria for the field "insuranceexpiry".
And needs to show records where the field "cowensform" is blank.These are all OR queries, so that as long as ONE of all of those criteria is met, the record shows up.Once that query works, I need a very similar query but only showing records where one or more of those criteria is met, but only if the record also has "Oldham" in the "area" field.
I can then copy that query and edit the "Oldham" bit to have a query for each of our area offices.I tried putting "Oldham" in the criteria line of the area field in the query design, but it seemed to have no affect.
I have a query that is hard coded with a date range.
SELECT tblCase.CaseId, tblCase.ReqReceived, tblCase.Letter_AMPI, FROM tblCase WHERE (((tblCase.Letter_AMPI) Between #4/1/2014# And #3/31/2015#)) OR (((tblCase.ReqReceived) Between #4/1/2014# And #3/31/2015#)) ORDER BY tblCase.CaseId;
I would like to create a parameter query that allows me to only enter the year and the query would append the rest of the date range. So for example, if I prompt the user to enter the date and they enter 2014, the query would know that it means Between #4/1/2014# And #3/31/2015# or if I enter 2015, it means Between #4/1/2015# And #3/31/2016#.As well the date would need to go into both fields ReqReceived and Letter_AMPI.
I have this cross table for a query called OUTPUT. The query has four fields (country, indicator, value and date). I want to cross table by date as follows:
Code: TRANSFORM Sum(OUTPUT.value) SELECT OUTPUT.country, OUTPUT.Indicator FROM OUTPUT GROUP BY OUTPUT.country, OUTPUT.Indicator PIVOT OUTPUT.[date];
This works fine but I'd like to visualise the date formatted by quarters instead of dd/mm/yyyy. I have modified my SQL code as follows:
Code: TRANSFORM Sum(OUTPUT.value) SELECT OUTPUT.country, OUTPUT.Indicator FROM OUTPUT GROUP BY OUTPUT.country, OUTPUT.Indicator PIVOT "Q" & DatePart("q",OUTPUT.[date]) & " " & Year(OUTPUT.[date]);
My problem is that using the DatePart and Year functions I miss the sorting.
Is there any approach that allows me to keep the date sorted in the cross table?
I have also tried to include the date formatting in the OUTPUT query and to sort the date there. It works fine there but when I create the cross table I again loose the sorting.
I am trying to calculate the total hobbs time (Ending Hobbs - Starting Hobbs = Total Hobbs) based on a user inputed date range. The query that I created (see attachment) doesn't seem to give me what I'm wanting.
I need a date prompt and null records in the same line of criteria so I get all those within a certain date range under the field "CO_resp_rcvd" and those that didn't respond yet but need to -- is that possible to do both and if so how would you show me how?
This is what I have currently in my query
CO_resp_rcvd (date field)
Criteria: Between [Start Date] And [End Date]
(I need null values as well because there will be some if the CO has not responded yet but needs to)
Formula:
This formula gives me the number of bus days from the Review Date - CO_Resp_Rcvd Date and that works but if the CO-Resp-Rcvd date is null, I need it to calculate Review Date - Today's date to show the number of days outstanding for those that have not responded yet in the same formula?
Not sure how to combine it to work - the wrapper is a bus day function
This is what I have so far in the query
CO-Bus Days to Respond: Wrapper([Review Date],[CO_resp_recd]) but if CO_resp_recd is null then ([Review Date],Date())
I have an database that uses a couple of different date ranges, so I created a table that shows the different date ranges that may be required (xReport Dates) so I didn't have to keep manually editing queries or entering dates every time.
I have one query that appends data from one table into another based on a date range that you need to manually enter when prompted; I can't seem to get it to refer to my xReport Dates table for the range.
I have a table, tblDailyCalls, that contains agent_name, date, calls_ answered, and talk_time. Ideally on a form, the user will select an agent, enter the date range in txtStartDate and txtEndDate and a report opens to show what the total amount of calls and talk time is for that date range.
All I've managed so far is doing a simple expression on the report itself to sum the fields I want. But my method returns every date in the range. I would like to only display the total.
I've been trying with Totals in the query and crosstab queries but am not familiar with them.
i'm trying to create a query of all employees doesn't have any transaction for a certain range of date and will also shows the last transaction date they have.i have two databases one is the transaction file and the other is the user file.
I have developed a database which has required many checkbox fields to enable analysis. It requires to have the facility to input random/variable date ranges for statistical purposes.
I have built a query which obtains the counts of multiple fields using the following parameters in Query Builder in Access 2010. Although this comes up with the correct results for these multiple fields when I try introduce date range the results come up blank for all results.
An example of the parameters used for one of the checkbox fields in Query Builder is as follows:
Field: SumAnger: Sum([Anger]*-1) Table: Default as only one table Total: Expression Show: Checked
This works fine.
My latest parameters for the date range are this:
Field: [cDate] Table: Default as only one table Total: WHERE Corrected! Whoops Copy & Paste Typo. Too early AM! Show: Checked or Unchecked makes no difference Criteria: Between [From Date:] And [To Date:]
This gives a statement in SQL view of:
SELECT Sum([Anger]*-1) AS SumAnger, Sum([Anxiety]*-1) AS SumAnxiety, Sum([Depression]*-1) AS SumDepression, Sum([Listening]*-1) AS SumListenig, Sum([Psychosis]*-1) AS SumPsychosis, Sum([Stress]*-1) AS SumStress, Sum([Other]*-1) AS SumOther, tblCommsLog.[cDate] FROM tblCommsLog WHERE (((tblCommsLog.[cDate]) Between [From Date:] And [To Date:]));
what I need to get this to work in Query Builder or failing that recommend some VBA script/code with embedded SQL to achieve the required report.
I have a single table with customer information, one of the fields is a date field "LastContacted".
I'm creating a search form with 2 date fields (txtDate1 & txtDate2) to search a date range of the LastContacted field, and I need to write this into the query that the search form uses.
I have written this using Nz so that it can still return results if the search boxes are left blank:
Between Nz([Forms]![frm_AdvancedSearch]![txtDate1],#01/01/1989#) And Nz([Forms]![frm_AdvancedSearch]![txtDate2],#01/01/2999#)
This seems to work and it returns lines from the table where there is a date entered. However some of the fields in the table have no entry in the LastContacted field. How to code this query so that it also returns lines where the LastContacted field is blank in the table?
I have tried:
like "*" & (Between Nz([Forms]![frm_AdvancedSearch]![txtDate1],#01/01/1989#) And Nz([Forms]![frm_AdvancedSearch]![txtDate2],#01/01/2999#)) & "*"
I have a form that request information from the user (StartDate, StartTime, EndDate and EndTime) the problem is that it's not working. The only way I can get any data to show is when I remove the StartTime and EndTime. Only then will it pull the items from the StartDate and EndDate.
Here is what I have as my criteria: Between [Forms]![OpPROD_ALL]![StartTime] And [Forms]![ OpPROD_ALL]![EndTime] And Between [Forms]![ OpPROD_ALL]![StartDate] And [Forms]![ OpPROD_ALL]![EndDate]
The users will be able to request a report based on a start and end date along with a start time and end time.
Side note: this is to pull date for 3rd shift (Example) 4/14/2013 10:00PM - 4/15/2013 10PM
I am trying to develop a query in MS Access 2010 to join two tables using three joins one of which is a (between) date range. The tables are contained in Access.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2. [ABCTABLE] ABCORDER ABCPART
I have a cross tab query. Essentially it groups together posted volumes into week numbers for different offices.
However, when I run the query, the order of the columns is not in a logical number order. I get Week 1 then Week 10 then Week 11 and Week 2 is further down the list and then Week 20 comes after that.
I would like if at all possible the Week Numbers to follow after one another i.e. Week 1 first then up to Week 52 in correct number order.
In my Dates Table I do have a SortID column which I hoped would resolve this issue so I could sort on the SortID column however this fails to work.
Attached is the query...
Code: PARAMETERS [Forms]![frmSumOfVolByCCAndFormat]![cmbOfficeSearch] Text ( 255 ), Forms![frmSumOfVolByCCAndFormat]![txtStartDate] DateTime, Forms![frmSumOfVolByCCAndFormat]![txtEndDate] DateTime; TRANSFORM Sum(tblTrafficEast.TrafficVolume) AS SumOfTrafficVolume SELECT tblOffice.CostCentre, tblOffice.OfficeName, tblTrafficFormat.Format, Sum(tblTrafficEast.TrafficVolume) AS [Total Volume]
I asked 18 people to each sort 100 statements into piles based on the similarity of the statements. The results are arranged as below.For example:
- Bob sorted statements 1, 3, and 100 into the same pile (Pile ID = 5), and statements 2 and 4 into the same pile (Pile ID = 2). - Mary sorted statements 1 and 100 into the same pile (Pile ID = 3).
Code: SubjectID StatementID PileID ------------------------------ Bob 1 5 Bob 2 2 Bob 3 5 Bob 4 2
[code]....
I need to create separate summaries for each Subject. The summary should indicate, for every possible pair of statements (1 & 1, 1 & 2, 1 & 3 ... 100 & 100), a 1 if the person sorted both statements into the same pile and a 0 if they didn't. Identical statement pairs (e.g., 1 & 1) should always get 1.
Code: StatementIndex1 StatementIndex2 Similarity 1 1 1 (identical statements always get a 1) 1 2 0 (Bob did not sort statements 1 & 2 into the same pile) 1 3 1 (Bob sorted 1 & 3 into the same pile) 1 4 0 (Bob did not sort 1 & 4 into the same pile)
[code]....
I'm assuming a crosstab query is a start, but I couldn't figure out how to set it up.
I have a dynamic cross tab query - thus the column headings will change each time it is run.
At present the column headings are displayed in alphabetical order - how can I change this so they are based on a different order - eg by the descriptions corresponding ID
I used UNION ALL to get results from two queries and I Succeeded.Now I want these results to be in a date range, so I want to enter the "starting date" then the "End Date" to have may results in specific date range.This is the original code out of UNION ALL which is working fine:
SELECT Count(Patient.PatientID) AS CountOfPatientID, Patient.CauseOfAmpLowerLt FROM Patient GROUP BY Patient.CauseOfAmpLowerLt HAVING (((Patient.CauseOfAmpLowerLt) Not Like "")) UNION ALL SELECT Count(Patient.[PatientID]) AS CountOfPatientID, Patient.[CauseOfAmpLowerRt] FROM Patient GROUP BY Patient.[CauseOfAmpLowerRt] HAVING (((Patient.CauseOfAmpLowerRt) Not Like ""));
And this is what I tried:
SELECT Count(Patient.PatientID) AS CountOfPatientID, Patient.CauseOfAmpLowerLt FROM Patient GROUP BY Patient.CauseOfAmpLowerLt HAVING (((Patient.CauseOfAmpLowerLt) Not Like "")) UNION ALL SELECT Count(Patient.[PatientID]) AS CountOfPatientID, Patient.[CauseOfAmpLowerRt] FROM Patient GROUP BY Patient.[CauseOfAmpLowerRt] HAVING (((Patient.CauseOfAmpLowerRt) Not Like "") AND (PatientService.[Date of Service]) BETWEEN [Start Date] AND [End Date]);
I have two tables. One is about 160 thousand records, which is a part number, a contract price and a day the price took effect. The items appear several times. Prices go up and down over the course of the data, and items are added and dropped.The second table is a list of dated sales and quotes of those items over the past 14 months.(About 10 thousand lines)
I need to match the items with the contract price that existed on the day the quote or the sale was created, so as to demonstrate we were always at or below the contract price.
I have a database with a table of employees, and that has a column named "DaysOff", into which I type a couple of days like this: "SUNDAY AND MONDAY"
Next, I have a form onto which I will display a query of those employees. The form contains a field called DATE in which I display the mm/dd/yyyy date. What I want to do is this:
I only want those employees that have a DaysOff field that DOES NOT CONTAIN the WEEKDAY NAME of the date in the DATE field. So, for instance, if the DATE field read 2/22/2014, and I have three employees as such:
Employee 1 DaysOff "Monday and Tuesday" Employee 2 DaysOff "Friday and Saturday" Employee 3 DaysOff "Sunday and Monday"
In that case, ONLY EMPLOYEES 1 and 3 should show up. Employee 2 will NOT show up, because his DaysOff field contains the word "Saturday", and the WEEKDAY FORMATTED value of the DATE field is "Saturday"
I hope that's not too confusing. Again, this needs to be the filter criteria for the query. That query will only return a list of employees that are NOT off on the day in question. If one of their off days is the day in question, the query won't return that record.
I've tried a few things, but I can't get it to work. If you want, I can list the various things I've tried, but I imagine one of you knows exactly how to do what I need to do, and you won't need my feeble attempts as a springboard.
Can anyone tell me if it is possible to input just one date range into a report that is accessing data from multiple table and multiple queries. I can create the report which gives me the info needed but I have to put the same date range in 3 or 4 time before the report is generated.
I'm using a form to select a date range. Using the following, and entering start date of 6/1/14 and end date of 7/1/14 I would expect to pull the records with a date of 7/1/14; however it doesn't. I have to enter and end date of 7/2/14 to pull 7/1/14 records.
>=[Forms]![F_Transaction_Date_Range]![txtStartDate] And <=[Forms]![F_Transaction_Date_Range]![txtEndDate]