Query: Count (amount Of (xDates Later Than GivenDate))
Aug 5, 2005
Hello all,
I have the following data (Note: dates in dd-mm-yyyy format)
ID DEPT TARGET70 TARGET90 TARGET100
-- ---- -------- -------- ---------
12 ACCT 12/06/2005 31/07/2005 21/12/2005
14 MKT 30/08/2005 02/09/2005 11/04/2006
19 ACCT 13/04/2004 13/05/2005 22/08/2005
20 SAL 12/12/2005 20/12/2005 12/02/2006
21 SAL 21/03/2004 21/03/2005 21/09/2005
etc. etc.
It basically shows what the target dates (TARGETxx) are for certain stages of a deparment’s (DEPT) different projects (ID).
What I have to do next, is proving to be quite trivial to me. Can someone please help? :)
I must compare the target dates to a certain date (which is stored in a global variable, say gdatTheDate), and then return all the projects (ID) for which a target date is later than gdatTheDate. But it (the amount of later dates) has to be counted for each dept and presented as follows:
Say gdatTheDate = 05/08/2005
Then the following is returned
DEPT NUM70 NUM90 NUM100
---- ----- ----- ------
ACCT 0 0 2
MKT 1 1 1
SAL 1 1 2
I know how to use the global variable in a query, but how do I implement the query to do the counting and grouping etc.?
Any help would be appreciated. Thanks,
J
View Replies
ADVERTISEMENT
May 31, 2013
I have a log in table that counts every time a user logs onto the database. Each time a user logs in it adds another entry to a table.
I have built a query to display the user name and date of log in so I could display this information in a report. The report is now getting rather long, and I am looking for a way to display each users name and have the total number of times they have logged in, not display each time they have logged in separately.
The Query has two fields "Agent Name" and "Logger Date"
The report displays the data as follows
Agent Name Logger Date
User 1 26/5/13
User 1 26/5/13
User 1 27/5/13
User 2 28/5/13
What I would like to do is have a report listing each users name, with a column showing how many times they have logged on. e.g.
User Name Login Count
User 1 3
User 2 1
View 10 Replies
View Related
Jun 23, 2014
In form (datasheet) I have a three columns "RightColors", "LeftColors" and "AmountOfColors"
I want to do something like this:
If I fill 'RightColors' "red;green;blue;", and fill 'LeftColors' "orange;" then in 'AmountOfColors' column should be "4". Sometimes I can fill only 'RighColors' or 'LeftColors;
I think I should add code in after update event. Is this possible to build code which can count colors using ";"? I need loop for this, right?
View 2 Replies
View Related
Mar 16, 2013
In Access 2003 I have a form, at the footer of which I want to put some summary information. One of which is a count of the number of purchases over £500. I have tried many variations after searching the posts on this site but the only one which does not return me an error of some kind with the expression is
=IIf([Bought For]>"500",Count([Bought For]),0)
where 'Bought For is the reports listing of the purchase prices in a given date range when opening the report, but the value returned in my test is '0' when it should be '2' as the test file has two purchases of over £500.
View 5 Replies
View Related
Jul 9, 2013
I am trying to count how many of the "same" and "differences", as well as calculate the percentages of the number of "same" over the total amount. To clarify, I work at a nursing home, and I need to calculate the number of people who were admitted to our facility and then to the hospital for the same diagnosis, and a different diagnosis. Then, out of the total number of people who were admitted to the hospital from our facility, I need to calculate how many of those people had the same diagnosis or a different diagnosis.
Also, I need to categorize these diagnosis by each type of diagnosis.
View 14 Replies
View Related
May 23, 2013
I have made a basic form and use it a log on screen. This requires the user to in put a user name and a password before gaining access to the main database.
The background to the form is a table where the users details are entered including the i enter the user name and password.
Is there any way to add a counter that is only visible in the table, so I can report on the different users.
View 14 Replies
View Related
Sep 13, 2013
i''m currently trying to count the amount of records that fall in each month in the date complete field. i am currently using a count query and it it bringing up the dates not the month.
View 1 Replies
View Related
Jul 21, 2015
I have One table(and designed form from it) in which i have recording the daily transactions(it is like a daily book). Daily transactions took place like Purchase of items of Amount 45, sale=70, sold on account=100 etc.
What problem i am facing is: I would like to Add Cash In Hand amount and would like to show it on my form. When day end I would like to move remaining cash In Hand on separate column of that date. The next day i would like to take the previous Remaining Cash in Hand as Cash In Hand at Start for next date and so on.
View 2 Replies
View Related
Jul 17, 2014
I am trying to make a report in which I can see the amount of money that I have to pay weekly to an employee. To explain myself clearer, I have different rates for each employee. For example:
NameNormalPayRateVacationPayRateSickPayRateOvertimePayRateStandbyPayRate
John Smith$15$10$15$30$8
Ken Jonson$10$8$10$20$8
I am doing this in a query. So what I want to be able to do is, for example, take 4 hours that the employee worked at NormalPayRate and multiply it. But if tomorrow the employee worked at a different rate, for example 3 hours overtime, I want those 3 hours multiplied by OvertimePayRate.
The way I saw it on my Google researches, is that they have only one rate and the amount will be [SumOfHours]*[Rate]. But how can I tell my query to skip, for example, one rate because the employee didn't work at that rate that day. So I can have different amount for the different rates.
By the way, entering the information I can divide at what rate the employee worked x day. So if the employee work 6 hours at regular, and later on 4 hours at standby, I have those information separated in my table.
Results that I am getting: I can easily get the amount in money multiplying the whole hours by a rate, so my result in my report will be multiplied by the same rate.
I am using Access 2013 ...
View 2 Replies
View Related
Jan 16, 2008
Hi,
I have 2 tables, one "new" and the other one called "old".
The thing is that the "new" one has more information (more columns) than the "old". So I can only do a Union query on the columns that do match, but it is possible to have the information from the columns in the "new" table added as well into that query?
Do I have to create the new columns in the "old" table before the Union query?
BR
View 1 Replies
View Related
Dec 10, 2007
Hi
Can anyone suggest a method for doing what the title asks. I basically have a single table with several fields. One of the fields is the length of music tracks in seconds. What i want to do is to set criteria so that when a query is run the records to not add up to more than 900 seconds.
1stly) Is this "do-able" using queries or do i need to start implementing sql statements which i have limited experience of?
2ndly) Can anyone recommend a suitable method to do so provided it isn't very complex.
My knowledge of Access is Intermediate.
Kind regards
View 14 Replies
View Related
Mar 30, 2006
Hi folks,
I have a query that returns about 3500 records (and runs very well I have to say). the issue comes when I attempt to export that queries results to a comma seperated text file. It gives me the message that the field is too small to accept the amount of data..bla bla bla... I've looked this up and it mentions stuff about memo fields and issues with that, but I don't have any memo fields in any of the tables that this is pulling information from. Does anyone have a clue why this would be happening...please help..this is urgent.
Thanks - J
View 1 Replies
View Related
Apr 14, 2005
I have a number of smaller queries that I want to join together to create a super query to display on a report. It works fine when I have a dozen queries joined, but as soon as I add any more, the query takes at least 10 minutes to run (although it eventually works). Is there a limit to the number of queries I can include in a query or is there some other underlying problem?
NOTE : the smaller queries only contain half a dozen records with totals.
Any ideas?
View 5 Replies
View Related
Apr 2, 2013
I run a physical therapy office and patients come in for treatment either 3, 4 or 5 times per week. My database is used to track these frequencies (among other things).
I have 3 queries which count how many patients come in 5, 4 and 3 times/week.
In my main table I have fields called "how many 5's", "how many 4's" and "how many 3's".
I have tried to design an update query which will update those fileds in my main table to reflect the counts in the 3 queries mentioned above.
(I'm not using SQL view, I'm using the query design view)
In the "update to:" row, I use the Build function and locate the count I'm looking for.
Problem: when I run the query I get the error: Operation must use an updateable query.
View 3 Replies
View Related
Feb 3, 2005
I have a script file of FoxPro 2.6 which is use to read amount field and write it in words.
Can any body convert in VBA Script.
I manualy write amount in words.
Thankyou.
Saira
View 3 Replies
View Related
Jul 26, 2006
Ok, hope you can help me with this one.
I have a select query that pulls data from one table that includes the following data
MOS Grade Required Authorized
I have a separate count query that pulls data from another table and counts the following data
MOS Grade Assigned
How do I combine these 2 queries so the results I get will be
MOS Grade Required Authorized Assigned
For instance:
Select Query Says
MOS Grade Required Assigned
25C E4 1 1
42A O3 1 1
38A E7 3 3
Count Query Says
MOS Grade Assigned
25C E4 1
42A O3 1
38A E7 2
I want the results to read
MOS Grade Required Authorized Assigned
25C E4 1 1 1
42A O3 1 1 1
38A E7 3 3 2
Hope you can help.
View 5 Replies
View Related
Sep 26, 2005
How many users can an access database support? I'm setting up an app accross 3 workstations but each has multiple users. There may be as many as 1000 records a day entered. Can an access database handle this or do I need to switch to sql server?
View 6 Replies
View Related
Nov 8, 2007
Hi
Is there any way i can increase the amount of columns in a table before importing data? I am importing data from a notepad doc that needs abt 300 columns but i can only get abt 100 columns.
Thanks for any help
View 8 Replies
View Related
Jun 2, 2005
Hi All.
I need to generate a query which will show me in Field1 Cost for the current year only and in Field2 Cost from a start date to the current. If is it possible how to do it?
Thanks.
View 1 Replies
View Related
Jun 3, 2005
I'm trying to produce a query that will bring up a list of all employees with their current salary amount. The table however, has all changes for an employee and reads as follows:
Table Name(NBRJOBS)
Employee ID-- Date of Change -- Salary Amt
1234 ----- 01/01/2003 -------- 500.00
1234 ----- 05/01/2003 ----- --- 600.00
1234 ----- 11/01/2003 ---- --- 700.00
2222 ----- 03/05/2004 ------- 200.00
2222 ----- 12/05/2004 ---- --- 300.00
2222 ----- 02/01/2005 ---- --- 300.00
It will be necessary to create a report to list out all employees and their current salaries. Any suggestions?
View 5 Replies
View Related
Dec 6, 2005
I have a table containing the following two fields, one with monthly dates (end of month plus year) and one with profits (per month). However, for some dates the records are missing. For example, for the 31-1-1994 there is no record (not in the date field, nor in the profits field).
How can i create a query that will only show me the records if 10 or more monthly subsequent profits are known, so meaning that in those 10 months no records are missing? So that only the timespans without the gaps (missing records) are shown.
So if the 31-1-1994 and the 30/6/1994 record are missing, then the 4 subsequent records in between those two dates should not be shown,, since the amount of records is not 10 or more. However, if the next missing date would be 30/6/1995, then all the 11 subsequent records between 30/6/1994 and 30/6/1995 should be shown. Since the number of records is bigger than the required 10.
Thanks for helping me out!
Luuk
View 4 Replies
View Related
Jul 14, 2007
I'm ok with Parameter Queries now, but I'm stuggling for the certeria to select say the top 20 records for a list. This would be based on a number, say amount spent.
Any help?
View 3 Replies
View Related
Nov 23, 2007
Dear all,in my table I have the following fields:- fldstartdate- fldstarttime- fldenddate- fldendtimeCan I calculate the time that is between those variables using an expression?fldenddate.fldendtime - fldstartdate.fldstarttime = "x days and x minutes"Kind regards,Hans B.
View 4 Replies
View Related
Feb 27, 2008
Hello All
if I have thirty records and have the end user select the first 8 or what ever amount they want, could be 3, 14, 9 etc, is this possible via a form ?
thanks
View 13 Replies
View Related
Mar 3, 2005
Make Table Name: tblnum
Fields:
1.num (for number)(Feed 1 to 99)
2.inword (for In words)(Feed One to Ninty Nine)
Make Module
Public Function inwords(amount As Variant) As String
Dim intlac As Integer
Dim intTh As Integer
Dim intHun As Integer
Dim intNum As Integer
Dim strLac As String
Dim strTh As String
Dim strHun As String
Dim strNum As String
Dim intlen As Integer
intlen = Len(amount)
Select Case intlen
Case 7
intlac = Left(amount, 2)
intTh = Mid(amount, 3, 2)
intHun = Mid(amount, 5, 1)
intNum = Right(amount, 2)
strLac = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intlac) & " Lac"
If intTh = 0 Then
strTh = ""
Else
strTh = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intTh) & " Thousand"
End If
If intHun = 0 Then
strHun = ""
Else
strHun = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intHun) & " Hundred"
End If
If intNum = 0 Then
strNum = ""
Else
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
End If
Case 6
intlac = Left(amount, 1)
intTh = Mid(amount, 2, 2)
intHun = Mid(amount, 4, 1)
intNum = Right(amount, 2)
strLac = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intlac) & " Lac"
If intTh = 0 Then
strTh = ""
Else
strTh = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intTh) & " Thousand"
End If
If intHun = 0 Then
strHun = ""
Else
strHun = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intHun) & " Hundred"
End If
If intNum = 0 Then
strNum = ""
Else
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
End If
Case 5
intTh = CInt(Left(amount, 2))
intHun = CInt(Mid(amount, 3, 1))
intNum = CInt(Right(amount, 2))
strTh = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intTh) & " Thousand"
If intHun = 0 Then
strHun = ""
Else
strHun = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intHun) & " Hundred"
End If
If intNum = 0 Then
strNum = ""
Else
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
End If
Case 4
intTh = CInt(Left(amount, 1))
intHun = CInt(Mid(amount, 2, 1))
intNum = CInt(Right(amount, 2))
strTh = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intTh) & " Thousand"
If intHun = 0 Then
strHun = ""
Else
strHun = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intHun) & " Hundred"
End If
If intNum = 0 Then
strNum = ""
Else
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
End If
Case 3
intHun = CInt(Left(amount, 1))
intNum = CInt(Right(amount, 2))
strHun = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intHun) & " Hundred"
If intNum = 0 Then
strNum = ""
Else
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
End If
Case 2
intNum = CInt(Right(amount, 2))
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
Case 1
intNum = CInt(Right(amount, 2))
strNum = DLookup("[inword]", "tblNum", "[tblNum]![num]=" & intNum)
End Select
inwords = strLac & " " & strTh & " " & strHun & " " & strNum & " Only"
End Function
Result = inwords(Number TextBox)
View 2 Replies
View Related
Sep 2, 2005
What is the maximum amount of fields/columns a table can hold in access 2003?
And what do you do if you have a form and its record source is a table that has run out of fields/columns?
If I remember right in access 97 it was 256 or 257 fields/columns was the max allowed. And it seemed to me it was quite common to run out of fields.
I'm currently waiting for my access 2003 upgrade disk to arrive and I'm
anticipating issues that might occur.
Thanks--Any help is much appreciated.
View 3 Replies
View Related