Help Please, (Access 2003)
I have made the expression for my count which i have done successfully (as you can see on my screenshots), but i would like to use a from and to date as we would run this query on a weekly basis.
The idea is to know how many enquiries each of our lawyers have had each week.
Is this possible?
If so could someone help me with the expression please.
Regards
Kyle
You would use the Between statement on your date field. For example - Between #5/1/2015# And #5/7/2015#
You can also replace the explicit dates with references to controls on a form.
18 1781
You would use the Between statement on your date field. For example - Between #5/1/2015# And #5/7/2015#
You can also replace the explicit dates with references to controls on a form.
Thank you,
would it only pick up the date if it was on the table i was doing the query on.
Bearing in mind i have set up the relationships on my tables.
As long as the table that has the Date field is included in the query, then you can use it in the criteria.
Oh right okay i got it now, thank you for your help its much appreciated.
Hi,
Sorry to bother you again, i have tried the expression but i keep getting this error: "The expression you entered contains invalid syntax"
"You may have entered a comma without a preceding value or identifier"
Please post the SQL for your query (inside CODE tags) so that I can look at it.
- SELECT Count("AH") AS [F/E]
-
,Between #2/20/2015# And #2/24/2015#
-
AS Expr1
-
FROM [Conveyancing Enquiries]
-
INNER JOIN [Conveyancing F/E Totals]
-
ON [Conveyancing Enquiries].ID
-
= [Conveyancing F/E Totals].ID;
It would not let me exit becuase of this error so i have had to take out Between, thats seems to work but i get -1 as the result and this definately isn't accurate.
The Between statement goes in the WHERE clause and it needs to know what field it is checking. For example, if your date field is called EnquiryDate, your query would look like this: - SELECT Count("AH") As [F/E]
-
FROM [Conveyancing Enquiries] INNER JOIN [Conveyancing F/E Totals] ON [Conveyancing Enquiries].ID = [Conveyancing F/E Totals].ID
-
WHERE EnquiryDate Between #2/20/2015# And #2/24/2015#
It now looks like this, is this correct? -
SELECT Count("AH") AS [F/E]
-
FROM [Conveyancing Enquiries]
-
INNER JOIN [Conveyancing F/E Totals]
-
ON [Conveyancing Enquiries].ID
-
=[Conveyancing F/E Totals].ID
-
WHERE ((([Conveyancing Enquiries].Date)
-
Between #2/20/2015# And #2/24/2015#));
I have ran the query and it does now seem to be pulling through the information i need, i am just going to try a different date just to confirm.
Yes all seems okay now once again thank you for your help.
Sorry for being a pain :)
This is how we all learn :)
zmbd 5,501
Expert Mod 4TB
You might want to update your SQL to use parameters instead of having to hard code this all of the time: Use parameters in queries and reports
and a slightly different viewpoint: How to use the query by form (QBF) technique in Microsoft Access
and the always useful Allen Browne: Limiting a Report to a Date Range
and here's a generic example based on a query I run in-house using the form... - SELECT TestDate
-
, ReadDate, Resample
-
, Passing, TestingResult1
-
, LotNo
-
FROM tableA
-
WHERE (((ReadDate)
-
Between
-
[Forms]![Form_PullDates]![Text_Start]
-
And
-
[Forms]![Form_PullDates]![Text_End]))
-
ORDER BY TestDate;
The form has logic behind it to check for proper date format, that start is an older date than end that they two dates are not the same etc...
Hi,
I have tried running the expression to count a particular value from a field (F/E Field) i want to calculate how many times a certain F/E has been entered but when i run the expression
Count ("PM")
It just counts how many records are in the table altogether rather than just one individual, is it the expression i am entering wrong or just the way the tables are set up.
Regards
Kyle
zmbd 5,501
Expert Mod 4TB
well Count("PM") is only counting the field named PM not specified entries. That would require a conditional clause.
generic example: - SELECT tbl_people.people_sex
-
, Count(tbl_people.people_sex)
-
AS CountOfpeople_sex
-
FROM tbl_people
-
GROUP BY tbl_people.people_sex
-
HAVING (((tbl_people.people_sex)="f"));
-
Would you post your SQL again?
- SELECT Count("PM")
-
AS [F/E]
-
FROM [Personal Injury Enquiries];
-
zmbd 5,501
Expert Mod 4TB
1) Does this give you any help: - SELECT Count("People_sex")
-
AS Wonder
-
FROM tbl_people
-
WHERE (((people_sex)="f"));
-
2) It is best practice when naming fields, tables, and files to avoid the use of anything other than alphanumeric characters and the underscore (spaces although allowed are problematic from a programing point of view and best avoided) and it is VERY important to avoid all reserved words and tokens: Access 2007 reserved words and symbols AllenBrowne- Problem names and reserved words in Access
Hi All,
Thanks for all your help but i did eventually find what i was looking for.
this seems to work and provide me with the info i need. - PARAMETERS [Month Number] Text ( 255 ), [Search Text] Text ( 255 );
-
SELECT [Personal Injury Enquiries].[F/E], [Personal Injury Enquiries].Date
-
FROM [Personal Injury Enquiries]
-
WHERE ((([Personal Injury Enquiries].[F/E]) Like "*" & [Search Text] & "*") AND (([Personal Injury Enquiries].Date) Like "*" & [Month Number] & "*"));
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ZyPhiX |
last post by:
Hi, I've got a little problem:
I'm trying to make a webpage with a few scrolldown menu's and I want
to count the values of them. In the scrolldown menu's are no numeric
values but the have to...
|
by: David Lozzi |
last post by:
Howdy,
I am trying to accomplish the following:
dim DateSend as date
if txtDateSend.text = "" then
DateSend = dbnull.value
else
DateSend = txtDateSend.text
|
by: Liam Mac |
last post by:
Hi All,
Can anyone direct me or provide advice on how I can assign a null value to a
date variable in vb.net.
Basically what I'm doing is that I'm looping through a recordset where I
have three...
|
by: scota |
last post by:
I am new to ASP.NET, C#. I have the following code which will not
display the total Credits for all the records. It is printing "Total
Credits: 0" instead of adding the credits. What am I...
|
by: HarisHohkl |
last post by:
Hi, I've this function in a class to update the total value.but when i try to remove the these row highlight in Bold it crash, what should i do????
void display_total_value()
{
double...
|
by: Stang02GT |
last post by:
Here is the issue that I am having. I have two text feilds where users need to enter a "From Date:" and a "To Date:" they then hit a update button and my code will pull back the data for the date...
|
by: alwaali |
last post by:
Hi
I need help please
This is my project and i need a help to solve it with you
A page of text is to be read and analyzed to determine number of occurrences and locations of different words. The...
|
by: Kenny24 |
last post by:
Hope someone can help with this problem I have!
On Access, I have a combination of 10 'true/false' buttons that can be selected. Eg. 10 different types of cake.
The user can select any amount...
|
by: irwansyahazniel |
last post by:
I want to calculate total value in index , previous value is 0, but I have replaced and display it with the calculation result “1/y”, and when I calculate total value, value that summed is previous...
|
by: shahed1985 |
last post by:
I create a MS access database with two table
Main_table : ID_number, Student_name, Class
Collection_Table : Collection_Date, ID_number,
Student_name, Class, PaidForMonth,Installment,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |