Half years in a query

I am making a query and need to split it into half years. When I split
it into quarters i use:

Format([SHIP_DATE],"q")

is there another letter/s to use in place of "q" for half years

Thanks
Matt

0
msmuzila
3/31/2007 5:48:27 PM
access 16762 articles. 3 followers. Follow

6 Replies
1681 Views

Similar Articles

[PageSpeed] 6

On Mar 31, 12:48 pm, msmuz...@gmail.com wrote:
> I am making a query and need to split it into half years. When I split
> it into quarters i use:
>
> Format([SHIP_DATE],"q")
>
> is there another letter/s to use in place of "q" for half years
>
> Thanks
> Matt


I don't think so, but you can probably use this is a calculated field.
IIF(Month([Ship_Date])<7,1,2)
(Based on June being 1st half)

0
storrboy
3/31/2007 6:39:34 PM
On Mar 31, 2:39 pm, "storrboy" <storr...@sympatico.ca> wrote:
> On Mar 31, 12:48 pm, msmuz...@gmail.com wrote:
>
> > I am making a query and need to split it into half years. When I split
> > it into quarters i use:
>
> > Format([SHIP_DATE],"q")
>
> > is there another letter/s to use in place of "q" for half years
>
> > Thanks
> > Matt
>
> I don't think so, but you can probably use this is a calculated field.
> IIF(Month([Ship_Date])<7,1,2)
> (Based on June being 1st half)

How would i write that if i want 1 to be the last 180 days and 2 to be
the 180 days before that (180 to 360 days ago)

0
msmuzila
3/31/2007 7:24:40 PM
I think it would be better then to use..
IIF(DateDiff("d",Date(),[SHIPDATE])<=180,1,2)

Check the results, not sure if I have the two date values in DateDiff
in the right order. There may however be a problem if it encounters
future dates. This might return a negative number and as such think it
is in the first half. You would either have to plan for that
possiblity (I don't know the circumstances so I can't), or it may be
that you have to have a fixed starting point for one of the two halves.

0
storrboy
3/31/2007 8:30:20 PM
On Mar 31, 4:30 pm, "storrboy" <storr...@sympatico.ca> wrote:
> I think it would be better then to use..
> IIF(DateDiff("d",Date(),[SHIPDATE])<=180,1,2)
>
> Check the results, not sure if I have the two date values in DateDiff
> in the right order. There may however be a problem if it encounters
> future dates. This might return a negative number and as such think it
> is in the first half. You would either have to plan for that
> possiblity (I don't know the circumstances so I can't), or it may be
> that you have to have a fixed starting point for one of the two halves.


I need to have it so i can show the last five 6 month periods

0
msmuzila
3/31/2007 9:59:33 PM
>
> How would i write that if i want 1 to be the last 180 days and 2 to be
> the 180 days before that (180 to 360 days ago)

Do you want 180 days? Or do you want half-years (182, 183 or 184 days 
depending on which half-year)?

I'd suggest using six-month intervals: try a calculated field:

DateDiff("m", [datefield], Date()) \ 6

This will be 0 for the most recent six months (from six months ago today 
until today), 1 for the six months before that, 2 for the previous half 
year, etc.

If you want half-years from January through June, July through December, 
that's another issue - it's not clear from your post which you prefer.

John W. Vinson [MVP] 


0
John
4/1/2007 4:41:05 AM
Thanks, that worked exactly the way i needed

0
msmuzila
4/1/2007 12:48:42 PM
Reply:

Similar Artilces:

Query help 11-28-07
I posted about part of this yesterday and got some great advice, but I just found out there are other issues that no one told me about. Here's the problem: I'm trying to create a query that will calculate how much someone has contributed year-to-date to their supplemental health care plan. Basically the employee agrees to contribute an amount of their choosing. This amount is then divided out so that the individual pays a certain portion of that out of each bi-weekly paycheck. We also need to stop calculating a running total for those employees who terminate, and instead c...

How can I hide points for future dates on a Year to Date chart?
I don't want future points to show because if there is no data, it either goes to zero, or I can keep the point the same as the previous month. Neither result is good for me. Jon Peltier has info on his site about this here: http://peltiertech.com/Excel/Charts/DynamicColumnChart1.html "rlmills" <rlmills@discussions.microsoft.com> wrote in message news:C6070EE5-0FC1-45B4-904F-0A51CA34F587@microsoft.com... > I don't want future points to show because if there is no data, it either > goes to zero, or I can keep the point the same as the previous month. > Ne...

RPC over HTTP/S on Exchange 2003
I have been configuring my single server with exchange to use RPC over https I have followed the instructions in MS guide and another simplified guide at http://www.petri.co.il/configure_rpc_over_https_on_a_single_server.htm Server spec is: Server 2003 standard SP1, Exchange 2003 SP1, XP client SP2 with outlook 2003 sp2 The bottom line is that when testing from the WAN, the outlook client will not connect and say that the exchange server is unavailable. I have a lot of experience configuring rpc over http/s with sbs2003 but this is the first time for server 2003 standard. I have outlook ...

Finding all queries which use a table
Hi, Does anyone know of a tool that can scan all queries in a database and find if a certain table is used? I have a table called tblCustomerRollup which is old and outdated. I want to see which of the 500 queries in my database use this table without opeing every single one of them? Thanks, -- Chuck W Chuck Sounds like a variation on Search/Replace. Try searching online for "Database Documenter" as a starting point. A couple of the commercial tools I've used include FMS, Inc.'s Total Access Analyzer and Black Moshannon's Speed Ferret. There are a lot of fr...

CRM Queries
Hi, I have a few queries that one of our customers has put to us. Can someone let me know their thoughts. Our customer wants to know whether it is possible to have something where within CRM you can view others users calendars? They would like to view it like you would in MS Outlook, the customer is going to be using the CRM Browser Client not Outlook for Sales. Also, within MS CRM I arn't sure whether this is a fault but I have managed to create 2 identical accounts, same name, contact numbers and account number. Is this what I should expect surely its something that needs fixing? D...

How to create an "and" rule in Query Based Distribution Groups
Hi, With Exchange 2003 Query Based Distribution groups, is it possible to create an "and" rule? ie, all users who are based in "London" "and" have the first name "John"? Thanks, Curtis. -- Please reply to news group only. Thank you. Sure. (&(attribute1=blah)(attribute2=blah)) http://msdn.microsoft.com/library/en-us/adsi/adsi/search_filter_syntax.asp?frame=true -- Bharat Suneja MCSE, MCT www.zenprise.com blog: www.suneja.com/blog ----------------------------------- "Curtis Fray" <xxx@xxx.com> wrote in message news:OjVc...

"Expr 1014" if field of query ?
In attempting to troubleshoot some problems in a query, I noticed that three of the fields (design mode of Access 2000) showed "Expr 1014", "Expr 1015","Expr 1016". Data exists in the fields when I execute the query. What does this mean? Correction: three of the fields (Run mode of Access 2000) BobC wrote: > In attempting to troubleshoot some problems in a query, I noticed that > three of the fields (design mode of Access 2000) showed "Expr 1014", > "Expr 1015","Expr 1016". Data exists in the fields when I execute t...

Simple Access counting queries
Hi, hoping someone can help a relative newbie with a pretty simple query. My database (Access 2007) has three tables: Customers Products Purchases (many-to-one links to both of the other tables, this is basically a linking table) I have two simple queries I'd like to get out of this database, but I'm a bit stuck on how to construct the SQL. Any direction you can give me would be helpful. 1. List of all customers who have purchased 2 or more products (or 3 or more products, or 4+, etc.) 2. List of all customers who have purchased both Product A and Product B (or A, B, and C, or B an...

Address query
I would like to create a spreedsheet that will check street adresses entered in an Excel spreadsheet against a master street index and then produce a new result in a new column. As an example if Post Street is in the master strret index then the result in the new column is Zone 4. If Birchwood Drive is in the master street index then the result in the new coloum is Zone 3. Any suggestions? Thanks, -- Bob On Sat, 12 Nov 2005 12:06:01 -0800, Bob <Bob@discussions.microsoft.com> wrote: >I would like to create a spreedsheet that will check street adresses entered >in an Exc...

Summing in A Query
Hello, I have a database which fuel records are stored in. The data is stored in two tables. The first records the daily logs that operators use each time they fuel up. It stores their name, the key they used (keylock fuel system - it's ancient) the unit number of the equipment using the fuel, and the amount of fuel they took. The second table stores the month end information retrieved from the key lock print out. It keeps a running total of the amount of fuel taken with each key, and the operator using that key. We have problems making sure all of the fuel is accounted for each mon...

exchange 2003 query.
Dear support team. I have installed windows 2003 server with exchange 2003 server. I have configured active directoty with the name called as domain_abc.com When i am creating users in my active directory, it is asking to create exchange mailbox. After creating the mail box i have modified the users email address in active directory. (e:g nilesh@domain_abc.com to nilesh@home.com I have another domain in my lan as home.com when i send mail from my mail idm mail should go as nilesh@home.com I am using third party pop connector .There i have mentioned the domain name domain_abc.com. ...

query ar remedy
I am trying to use the parameters to query ar remedy. When i run th query i get a error message Driver parameter missing. then it stops Any help is appreciated. I am using the AR odbc driver -- Message posted from http://www.ExcelForum.com I am also experiencing the same issue when running a parameter query using the AR ODBC driver. The parameter query returns results perfectly when run in MsQuery, but when the query attempts to return those same results to Excel, the Driver]parameter missing error is received. I have not been able to find anything online regarding this specific problem ...

Query to hide duplicate records
I recall that this used to easy in previous versions (Unique values only ??), but in 2007, I can't get this to work at all. I have a table with our companie's job numbers in it. The job numbers show up multiple times because of different phases of the project: ProjNum ProjDescription 3077 Univ. of Vermont/UC/LEED 3077 Univ. of Vermont/University Commons: Building Fee 3077 Univ. of Vermont/University Commons: Excess Professiona... I need to jut have a single listing of each project number, otherwise, I get repeated records in the query that looks at this information (which ...

Query fields
Is it possible to write a criteria where the value of an empty field is "0.00"? Background: I have three queries with different customer account groups. Not every salesperson has customer accounts in every accountgroup - so, he will not shown up in that query. But he has accounts included in another query. Now, I would like to get a sum of commission earned by each salesman calculated from all three queries together. Since the salesman has no record in one query the total sum of that specific salesman is not shown. Any idea how to solve that problem? Thanks Klaus On Wed, 29 A...

QBF/Query on report
Hi folks, I have numerous reports that are based on different queries. What I am looking for is a way that if a user wants to pull a certain report, that when this report is selected from a form, the user has the option based on different fields to drill down the information being returned in the report. For example, one report would give details of all invoices to be paid (considered incomplete). I want to give the option to the user to select the from and to dates that the invoice was received for example. Or again, the user may want to search for all unpaid invoices that belong t...

Problem with vba code to export query result in excel
Hi, I have a access report that exports to excel with click of a button after choosing parameters. This works well. However I have to modify couple of fields to utilize formula in the export module. I am not sure how to do this. I am writing the above code which seems to cause problem. I appreciate any help to resolve this issue. Thanks. Code: If lngColumn = 12 Then xlc.Offset(0, lngColumn).Value = =([UnitPrice]*[OriginalShippedQty])/1000 End If It seems the fields UnitPrice and OrigianalShippedQty are not being recognized here Jack wrote: >Hi, >I have a acces...

How to get only the year in the date format in Access
How to get only the year in the date format I.e in the table in need to display only year E.g 2005 - should be display " 05" automatically Custom format the cell as: yy -- HTH, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "yanu" <yanu@discussions.microsoft.com> wrote in message news:14CE9F60-F7B9-467A-8C16-71088C31BEBA@microsoft.com... > How to get only the year in the date form...

Problem with charting Net income vs Year
Im having some problems with my Excel chart. It will not plot Net Income vs Year. It keeps trying to treat Year as a different data series. It will work if I use text i.e. a1990, a1991, etc. but it refuses to use 1990, 1991... Any Ideas??? Use an "XY (Scatter)" chart, instead of a "Line" chart. Jerry Hunter wrote: > Im having some problems with my Excel chart. It will not plot Net Income vs Year. It keeps trying to treat Year as a different data series. It will work if I use text i.e. a1990, a1991, etc. but it refuses to use 1990, 1991... Any Ideas??? Delete the co...

How can I time long running queries?
Hello all, Is it possible to time long running select queries? I was looking at creating some code to do this....something like: 1. Store current time in a time variable 2. Try to programmatically open a query ("open" meaning just like manually opening a select query from MS Access to view data) using "Application.CurrentDb.QueryDefs("Query3").OpenRecordset dbOpenTable". 3. Check the current time and compare it to the start time saved at the beginning But, I get "Run-time error '3219': Invalid operation." when I run "...OpenRecord...

Calculating age in years and months from Date of Birth
I think these formulas help me a lot, but I need the answer in years an months, not decimals or days! Can you help? To calculate the number of years from the date, enter the followin formula in cell B1: =YEAR(TODAY())-YEAR(A1) The result (rounded): 23 Years For a decimal solution, use the following formula =DATEDIF(A1,TODAY(),"m")/12 The result: 23.25 Years To calculate the number of months from the date, enter the followin formula in cell D1: =DATEDIF(A1,TODAY(),"m") The result: 279 Month -- Message posted from http://www.ExcelForum.com Hi try =DATEDIF(A1,NOW(),...

Report on 3 Queries by Date
Hi I have 3 queries which I would like to join into one based on the servicedate/taskdate so that for any given date I can see the totals of each type of task we log for work. I would have joined these using a simple query however my issue is that not everyday I log an event in any one table (Each query based on only one table). Query1 ServiceDate CleanTimeTotal QATimeTotal ESTTimeTotal Query2 ServiceDate RepairTimeTotal Query3 TaskDate TaskTimeTotal Now I suspect I need to rename TaskDate to ServiceDate in Query3 above which I am okay to do but have no idea how to set up the...

ODBC database query
I am working with an Access database to keep track of everyone's jobs at work. I have Excel files with macros that pull information from the database and display it in a report form. My problem is that I seem to be running out of space within the macros. I get to the database using an ODBC link. Once I filter the data and complete the macro, the filtered data displays perfectly, but if I save and close the file, then open it again, the macro contains errors. When I open the macro and look at the coding, it looks like it cuts off at a certain point as if I had filled my character quot...

Report Query in RMS
Is there somewhere that I could get some information as to how the reports in RMS are composed. When you look at the various reports they all seem fairly simple in there basic structure. Are the any examples of how these reports are composed. The //--- Columns ---// iformation seems to be the same in most reports, same as the //--- Title Rows ---//. Setting up the flitters and the TablesQueried I need to understand. I have the schema for 1.2. How do I better understand the following or what do I need to learn. I wish I was in college again and had all the time in the world. //--- Repo...

Workflow query
I'd like to be able to activate a workflow rule when any Update event to a Case occurs (i.e. not a standard Manual, Assign, Create or Change Status event). Any ideas? PS: Merry Christmas everybody! You won't be able to this by workflows. You'll need to write custom code to trap the Update event. "Datapac" wrote: > I'd like to be able to activate a workflow rule when any Update event to a > Case occurs (i.e. not a standard Manual, Assign, Create or Change Status > event). > > Any ideas? > > PS: Merry Christmas everybody! MS has just ...

Difficult query
Hi, I have a table called WT,contains the fields "Type of call","DateW" and "ID", this table is used to by users to add rows that determine type of calls received in a call center,I want to create a query with the following criteria: 1- To view number of calls received in each type per day. 2- To show the field "Type of call" in this query,even the type that wa not used,and to view number 0 in the count field. 3-Prcentage of each type of call . On Dec 11, 3:52 pm, Pietro <Pie...@discussions.microsoft.com> wrote: > Hi, > I have a tabl...