Newbie Question About Date Ranges
Jan 12, 2007
I must be having a bad day, as I can't get something really simple to work. I have a query, that amoungst other things, I want to select all records between two dates. For instance, the table has a 'ScheduledDate' field, and I have set up two parameters in the query that prompt for 'From' and 'To' parameters.
In design view, I have tried the following in the 'criteria' box for the 'ScheduledDate' field;
>=[From] <=[To]
This doesn't work ~ can anyone point me in the right direction. I've searched the forum, perhaps not using the correct keywords?
All help appreciated.
View Replies
ADVERTISEMENT
Nov 6, 2006
I run various queries on a daily basis for multiple date ranges (previous day, week to date, month to date, and year to date). The below criteria allows me to get WTD numbers but it has a flaw. When I run the reports on Monday, this criteria gives me Sunday and Monday's data when I actually want the previous week's data. Does anyone know of an iif statement that basically, says, "If today is Monday, give me last week's data, else give me wtd of the current week?" Right now, I manually change the criteria on Monday morning to hard code the dates and then revert to the formula on Tuesdays but I need to have this completly automated because there are a large number of queries and I don't have time to change them all. Thanks for the help!
Between Date()-Weekday(Date()-1) And Date()-1
View 2 Replies
View Related
May 19, 2005
I received help on previous threads. Basically, I have built a query to group by course title and then select the number of students that were assigned a course during a specifc time frame. Is there a way to show multiple columns in the query. For example my query now shows, enrollment for March, I would like to column next to it to show enrollment for Feb and then another column for Jan.
This is my current sql view.
PHP Code: SELECT tblContent.Title, Count(*) AS [Students Assigned]
FROM tblProfile INNER JOIN tblContent ON tblProfile.LoginName = tblContent.LoginName
WHERE (((tblProfile.LastName)<>"Demo" And (tblProfile.LastName)<>"Care" And (tblProfile.LastName)<>"Robins") AND ((tblContent.Code) Like "NH*") AND ((tblProfile.Groups) Not Like "*Professional Development Center*" And (tblProfile.Groups)<>"All Users,Professional Development Center") AND ((tblProfile.Delete)<>Yes) AND ((tblContent.Type)="Learning Track"))
GROUP BY tblContent.Title, tblContent.[Date Assigned]
HAVING (((tblContent.[Date Assigned])>=#3/01/2004# And (tblContent.[Date Assigned])<=#3/31/2004#));
Thank you in advance for any help you can offer.
View 6 Replies
View Related
Feb 18, 2013
I have a table with employee names and there start time and stop time for their shift. There is also a start time and stop time which they cant work during their shift. So I have shiftstarttime and shiftstoptime and codestarttime and codestop time. I have to create a table with the employee names and generate a time called outboundtime. This outboundtime starts at a specified time (e.g. 9am) and runs for a specified time (60mins). This outboundtime has to be within the range of the employees shift and cant be within the range of the cant work time. If it was, then it would start after the codestoptime for that employee.
I have been trying "if then statements" but I can't seem to compare a range of time to another range of time. Only a specified time to a range which is making things confusing.
View 1 Replies
View Related
Aug 23, 2005
Hello,
Am posting this message (also on reports forum) as i dont know whether the problem is at report or query level. Hope you can help.
Hello all, this is probably simple but im new to all this!
I am trying to produce reports that show details for only the past year, at present my reports are bringing up details of all the previous years also. Is there any way you can put conditions on reports ( or should it be in a query) that tells the report to only include dates i.e. today - 365 days. At present i have to change the dates every day both a start and end date. Is this possible?
Thanks
View 2 Replies
View Related
Dec 15, 2005
I am attempting to create a parameter query to show a specific range of dates of service for my customers. Example: I want to see data from my table from Jan. 1st, 2006 to Feb. 15th, 2006 for any customers serviced in that time frame. In the query I have under my Date field, I have the following in the criteria field: Between [Input Start Date] And [Input End Date]. When I go to the while in the design mode of creating the query on the main menu under Query then to parameters and get my Query Parameters what should be put into the Parameter column and the data type columns and will this allow the user to input any start date and end date and get the information from the master table?
I also need to create a parameter query that will allow viewing of only each months table data. Example: Jan. 1st, 2006 through Jan. 31st, 2006.
Thanks in advance!
View 2 Replies
View Related
Dec 27, 2007
Calculating dates between TWO date ranges:
I've read alot of good things on here regarding the DateDiff function and some other things that have helped me out finding the difference between two dates within the same entry on a table. I have a question regarding finding the difference in days between two entries within the same table.
Example:
test table:
Date ID # Name
1/18/07 1234567 Smith
1/20/07 1234567 Smith
1/23/07 1234567 Smith
Is there a way to find the difference in days between the lowest and highest dates? I want to know how many days are between the first entry and the last entry? In this cae it would be five days. I can do it if the days are in the same entry with the datediff function, but having trouble finding it in this situation. Any pointers?
(Thanks for all the good information on this site, BTW. I've seen a few posts similar to this, but it didn't really answer my question)
Don
View 3 Replies
View Related
Sep 26, 2007
I am trying to put together a quick database for my HR team. I need to be able to pull multiple date ranges to show which employees are up for an annual, 6 month and 90 day review.
Is it even possible to put multiple date ranges in one query, or is this going to get complicated? I have no real database background, and know absolutely no SQL so I'm flyin by the seat of my pants here...
View 2 Replies
View Related
Aug 10, 2015
I need a query that will relate values to given date ranges. For Example:
Table: TaxTypeRange
Values:
TaxType; FromDate; ToDate; Contact
W2; 1/1/15; 3/31/15; Tom
1099; 4/1/15; 6/30/15; Tom
W2; 7/1/15; 12/31/15; Tom
Table: Bills
Values:
Contact; BillAmount; BillDate
Tom; 1000; 3/31/15
Tom; 1100; 4/30/15
Tom; 1200; 5/31/15
Tom; 1300; 6/30/15
Tom; 1400; 7/31/15
Requirement: For every period where the TaxType = W2 the query should multiply the Bill amount by 1.20, so the result should be something like this:
Query: BillsAndTax
Values:
Contact; BillAmount; BillDate; TotalBill
Tom; 1000; 3/31/15; 1200 (TaxType = W2 so 1000* 1.2)
Tom; 1100; 4/30/15; 1100 (TaxType = 1099 does not apply 1.20)
Tom; 1200; 5/31/15; 1200 (TaxType = 1099 does not apply 1.20)
Tom; 1300; 6/30/15; 1300 (TaxType = 1099 does not apply 1.20)
Tom; 1400; 7/31/15; 1680 (TaxType = W2 so 1400 * 1.2)
Not sure how to set this up the right way.
View 3 Replies
View Related
Nov 5, 2012
I have not found the solution to this looking elsewhere, but basically what I am trying to do is the following:
person date
1 1/1/2012
1 12/15/2012
2 6/12/2012
1 6/13/2012
2 6/14/2012
3 6/16/2012
I want a query which shows the count or records for which a person has a date within 30 days of each other. This is being queried from a large table in which records would may not be sequential by person. Thus in my example above, the third record for person 1 would be omitted as well as the record for person 3.
View 1 Replies
View Related
Mar 12, 2015
i have 2 tables.. 1 with bookings and 1 with a BonusPeriod range.
in the Bookings table there is a field called [ServiceDate]
in the bonus table i have a field called [Period] which is text i also have 2 dates, [StartDate] And [EndDate] i need to Dlookup the Bonus table to return the value of the period table based on where the [ServiceDate] falls.
i dont want to use VBA (i really need it to work within a query that inserts it's data into another table)
i've tried everything but had no joy
Expr1: DLookUp("[Period]","BonusPeriods","[ServiceDate]" Between "#[StartDate]#" And "#[EndDate]#")
Expr1: DLookUp("[Period]","BonusPeriods","[Staff_BookingsAndQuotes_Master].[ServiceDate]" Between "#[StartDate]#" And "#[EndDate]#")
Expr1: DLookUp("[Period]","BonusPeriods","(FormatDateTime([ServiceDate]),"yyyy-mm-dd") Between (FormatDateTime([BonusPeriods]![StartDate]),"yyyy-mm-dd") and (FormatDateTime([BonusPeriods]![EndDate],"yyyy-mm-dd"))))
View 10 Replies
View Related
Oct 7, 2013
I have a form which I am using child/master fields to create a filter (see attached pic)
For the date ranges I need these to be
>= Start Date and <= Actual Finish Date
How can I set the criteria for these two fields, so that when someone picks a date it knows it's from or before the date entered.
View 14 Replies
View Related
Jan 1, 2015
I have tried search through some forums and but still not able to get desire results.
Table Customer Agreed Transport Rate
Customer > Eff Date > Route > Rate
A > 1 June 2014 > AAA > MYR 99
A > 15 Aug 2014 > AAA > MYR 88
A > 1 June 2014 > BBB > MYR 77
A > 1 Sept 2014 > BBB > MYR 66
B > 5 June 2014 > CCC > MYR 88
B > 20 Oct 2014 > DDD > MYR 100
C > 1 Oct 2014 > EEE > MYR 222
If there is order from Customer A for Route AAA loading on 2 July 2014, I can easy to get answer "MYR 99".
How if I wish to make Route as primary key? (as I understand, Primary key must be unique and no repeat).
View 10 Replies
View Related
Oct 24, 2004
I am using a MFC dialog window to retrieve data from an Access database.
My code, that does not work, looks like this:
CFacilityWorkshopSet set;
CTime date(1999, 1, 11, 0, 0, 0);
set.m_strFilter.Format("Workshop.StartDate='%d/%d/%d' ",
date.GetMonth(), date.GetDay(), date.GetYear() );
set.Open();
When I hook this exact code upto an identical SQL database, it works perfectly.
However when I use it with my Access database, I get the messagebox error:
"Data type mismatch in criteria expression."
Can anyone help me correctly format the query statement so that it will work?
View 1 Replies
View Related
Sep 25, 2004
This is my first stab at this and I'm obviously overlooking something. I'm trying to do a recurrent date append to an Access calendar db. I'm trying to take the field varStartDate and add 7 to it for the # of weeks recurring. Works great. I type the var out and it is appending correctly BUT when I look at the db, it is putting the ORIGINAL START_DATE and not the RecurDate var. What am I doing wrong?
TIA!
Lisa
Dim strSql
startDate = CDate(Request.Form("varStartDate"))
IF Request.Form("numWeeksRecur") > 0 THEN
Weeks = Request.Form("numWeeksRecur")-1 ' *** Subtract week from total week for first Command.Execute
For recurDate = startDate To startDate+7*Weeks Step 7
fldStartDate = recurDate
fldStartTime=Request.Form("varStart_Time")
fldEndDate=Request.Form("varEnd_Date")
fldEndTime = Request.Form("varEnd_Time")
fldeventTitle=Request.Form("txtEvent")
fldevt_grp = Request.Form("txtgroup")
fldlocation = Request.Form("txtLocation")
strSql = "INSERT INTO events (start_date, start_time, end_date, end_time,eventTitle, evt_grp) VALUES fldStartDate, "
'FOR DEBUG ONLY
Response.Write(fldStartDate) & "<hr>"
Response.Write(recurDate) & "<hr>"
'Response.End
MM_editCmd.Execute strSQL
Next
END IF
View 2 Replies
View Related
Sep 6, 2006
I have a form in which users enter a start date and an end date to reserve meeting rooms. The restriction is that the dates have to be within one year of today's date. The message box saying the same should come up & restrict users from entering the dates. How do I accomplish this?
Thanks,
View 1 Replies
View Related
Mar 22, 2008
Everything works great but I want to save the backup file with a unique name, like EX: myfile INTx.xls where intx = the date "Now", maybe, am I looking at this wrong.
Thanks Bob
View 12 Replies
View Related
Nov 17, 2004
Hihi
I have a field containing data in this format
01Apr04:12:34:56
for example
It is not recognized as a date by Access, so it is stored as text
I need to put it in any general date/time format, like
dd/mm/yy hh:nn:ss
I also need that Access actually reads it as a date/time (not a string) to be able to merge with other data, then sort chronogically.
How can I do that (please no code, only query if possible, i'm really a newbie...)
thx!
caroline
View 1 Replies
View Related
Aug 19, 2005
I need a form to set up records
The table is something like
AutoID, Sequence , Low, High
Data would be
1, 1, 1 499
2,2,500,999
3,3,1000,9999
4,4,10000,999999
etc
Ho do I go about ensuring my sequences are correct
ie I wouldn't be able to add a record - 5,5,100,200
or if a user was to delete a record the user would be informed the sequences were out?
Thanks for any assistance.
View 2 Replies
View Related
Jul 27, 2005
Hi all,
I am relatively new to access and need some help.
I have table with ranges of postcodes (NL) and regions. For instance
Table_Regions_Range:
Amsterdam 1000-1119
Haarlem 2000-2099
etc
And i have a records of schools:
Table_Schools:
SchoolA 1050
SchoolB 2050
etc
I want to query the data base and lookup in wich regio a school is based.
Where do I begin?
Thanx in advanced
Jan
View 1 Replies
View Related
Feb 13, 2008
Hi all
I have a bunch of student test scores. The test is scored out of 100. I want to COUNT the scores (ie I want to know how many kids scored 50 etc...). This is easy enough except the crosstab query will be very wide ie 100 columns.
I cant seem to reduce the size by grouping them into ranges (ie count the number of kids that scored between 50 and 60 in a cross tab. I've tried variations with select queries but without luck.
Maybe there is a way to code it.. and then show it on a report??
Any ideas?? Thanks
View 7 Replies
View Related
Jan 4, 2006
I have a form that is similar to a post card. The fields are linked to a master table that contains all the customer data such as dates of service, street address, PO Box, City, State and zip. What I need to do is have a method to pull into the post card form a range of dates, so the form would have only January customers in it. I have parameter query that pulls ranges but it comes up in table form. I need the range to come into the fields on the post card so I can then print just the month of January.
Do I need to create a button on the form for the ranges and if so how do I get it to pull just one month's customer data into the fields on the post card form or can this be done?
Thanks in advance for the help.
View 2 Replies
View Related
Jun 21, 2007
Hi, I'm very new to this so your patience and help is requested.
I need to store multiple ranges per record in my relational db, i.e.
A: 3500-4800, 5230 (spot) , 6400-7900
Etc, I need the data to be searchable with minimal fuss and coding.
Any help would be very very welcome.
Cheers
View 5 Replies
View Related
Jun 12, 2014
I am trying to import data from an Excel file to MS Access (2013).
The Excel sheet consists of 700 columns. A group of 7 columns (always same header) are to be implement in Access one among the other.
That means:
At first columns A-G, than columns H-N, than columns O-U
I am trying to solve this with a loop (as you can see in the code)
But, if I start the modul I get this error:
"Runtime error 1004. The method Worksheets for _Global object failed"
But the module works, of I start it a second time. The error message appears only at the first start.
Apart from that, the code works. Sometimes, the module imported empty rows into the Access table.
Code:
Sub ExcelImport()
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
xlApp.Workbooks.Open FileName:="C:Users...DesktopBeispiel.xlsx"
[Code] ......
View 1 Replies
View Related
Apr 11, 2013
My goal is that the user can choose start date and end date use the calendar implement in the userform, and then the VBA will automatically select the data range from access and updated into the defined worksheet in Excel. I managed to connect to access, just don't know how to implement the selection with the two date(the start date and end date).
Code:
Const strDb As String = "C:Documents and SettingsYuCMy DocumentsDatabase1.accdb"
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim strdate As String
Dim endate As String
[code]....
View 2 Replies
View Related
Oct 1, 2014
How do I count the number of records with values within specified ranges?
My database contains a field with values ranging from say 1 to 1000. I need to write a query to show count the number of records with values in ranges I specify in the query.
I'm looking for output such as
<100 - 50 records
101 - 500 - 30 records
501 -1000 - 50 records
View 2 Replies
View Related