I have a query set so I pull DISTINCT dates in the SQL from 1/1/08 thru 12/31/08 to take out duplicate accounts, this works great when I run the report quarterly or yearly but I need to run this report monthly. I have 3 tables that work together and these dates are coming from my Activities table, I keep track of when I have had contact with them. I am looking to only count these people 1 time in a year (filter by start date does not work is it is driven by actibvity date) for example if I work with them in 1/08 run my report in 1/08 they should show up. If I work with them in 2/08 I do not want them in my 2/08 report as they were counted in 1/08.How can I filter these clients out. What expression, operator word(s) or do I need to do it in the SQL can I use. I have tried Select DISTINCT [Actibity Date] between 1/1/08 and 12/31/08 What string do I need to use to filter out the people I counted in 1/08 and so on.
An expert who has written 3 tips or uploaded 2 video tips.
Re: Microsoft Access Query
Your date form is what it wrong. In order to use dates in Access with a BETWEEN function clause the values have to specifically be dates.
You can create dates in literal strings using the # sign to bound them, as in:
Select DISTINCT [ActivityDate] between #1/1/08# and #12/31/08#
#....# tells Access to treat this literal string as a date.
If you are using non-literal values, such as a parameter handed into the query, which would then be a variable, you can't use #some_variable# to cause Access to view it as a Date since #...# is for literal values only. To convert (also called "casting" a variable), use the CDate function. CDate likes to know what format to expect the string to come in though so it helps to pass that along, as in:
Select DISTINCT [ActivityDate] between CDate(begin_dt_string) and CDate(end_dt_string)
Remember the date string you pass into CDate has to be readable as a date by CDate. So make sure you pass in something that it can handle (use the IsDate() function to check to be sure so you can avoid a runtime datatype casting error). If your locale is US, then passing in x/y/z it will take for MM/DD/YYYY. If Europe, it will take it as DD/MM/YYYY. So keep that in mind.
To convert out of a date, use the FORMAT() function. That is how you get a date data type value to become a string value.
More fun reading: http://www.techonthenet.com/access/functions/datatype/cdate.php http://www.techonthenet.com/access/functions/advanced/isdate.php http://www.techonthenet.com/access/functions/date/format.php
- If you need clarification, ask it in the comment box above.
- Better answers use proper spelling and grammar.
- Provide details, support with references or personal experience.
Tell us some more! Your answer needs to include more details to help people.You can't post answers that contain an email address.Please enter a valid email address.The email address entered is already associated to an account.Login to postPlease use English characters only.
Tip: The max point reward for answering a question is 15.
There is one SQL password recovery tool, SQL Password Genius, which would help you to successfully change SQL Server 2005/2008/2012 user password instantly, especially when you couldn't think of other ways for it.
1. Open SQL Server Configuration Management and stop SQL Server Services.
2. Install SQL Password Genius full version and run it on computer.
3. Click "Open File" button to import master.mdf database file into this recovery tool.
4. Select user in list and click "Reset" button.
Instantly, new user password would be available for SQL Server logon after you type new password for user.
Now, SQL Server user password has been changed and you can login into SAL server now. But please remember to restart SQL Server Services before you access to SQL Server with user password.
Try using Data > From Other Sources and select From Microsoft Query. In the Excel sheet, select the cell that you want the results to start in. Your MS Query would be pulling the data from your Access database.
open your table in query, follow steps to do this...
1. open new query in access
2. locate the table
3. once table selected, select field name in selected table you only want to include in query
3. once finished selecting the field save the query
4. you can now view selected field in your table and print as well
5. you can edit the query anytime if you want to add or remove field
6. query will not affect your table since this is only query.
before this u should know what is databse.
ms access has various objects likw table,form,query,report etc..
table is a object which stores the actual data and form is used to enter the data in to the table and display the data from the table, while report is object which is used to desplay your data in required formate.Query is used to fetch the data from the table in customised formate.for that u should have knowledge of SQL.
Two ways to access your server. First, make sure the SQL Server Service is running. Start | Run | Services.msc | Enter. Look for Microsoft SQL Server Service and that it's running. Or Look for the SQL Service Broker icon by the clock and see that it's running. The default instance of SQL Server uses the Hostname. Start | Run | Cmd | Enter. The type hostname. This will be the name to access to server. Then type IPCONFIG, this is then the IP address that you could also use to access it.
SQL Server runs on port 1433, so any firewall has to have it open.
Open Query Analyzer, type in the hostname or ip of the local box, type in "sa" and the password for sa (if setup in mixed mode) or Windows Authentication.
Once you login in, you should now see the databases in the Tree on the left side under the Server | Databases node.
Your description though states "SQL Server won't work on my laptop". TO answer this, the only two SQL Editions that work on anything other than "SERVER" software is SQL Professional and SQL Developer. All others have to be on a "SERVER" platform.