[mso] Re: Access 2002: Convert Number To String (Quarterly) :VSMail mx5

  • From: James LaBorde <jlaborde@xxxxxxxxx>
  • To: "'mso@xxxxxxxxxxxxx'" <mso@xxxxxxxxxxxxx>
  • Date: Wed, 14 Jul 2004 09:32:21 -0700

Cathy,

The reason you are getting so many records is because it is pulling in each
unique DateIssue field for you.  In order to get what you are looking for,
change your first field to:

YearIssue: Datepart("yyyy",[DateIssue])

This will pull only the year part of the date and should allow you to get
only one instance of each quarter per year.

Don't be afraid to use the date functions and formulas in your header
either.  When you run the report, do you run it for the previous quarter or
do you run it for different quarters?  If its the previous quarter, check
out my article on Date Functions in  the ABC archives.  You could actually
set it up to automatically pull the dates so your users wouldn't have to
enter them. 

If you have any more questions, please feel free to ask.  

James

-----Original Message-----
From: Cathy.Evans@xxxxxxxxx [mailto:Cathy.Evans@xxxxxxxxx]
Sent: Wednesday, July 14, 2004 5:15 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access 2002: Convert Number To String (Quarterly)
:VSMail mx5



Glad to, James.  Here is the query SQL:

SELECT DISTINCT tbl_CPM.DateIssue AS YR, Switch(DatePart
('q',[DateIssue])=1,"One",DatePart('q',[DateIssue])=2,"Two",DatePart
('q',[DateIssue])=3,"Three",DatePart('q',[DateIssue])=4,"Four") AS Quarter
FROM tbl_CPM
GROUP BY tbl_CPM.DateIssue, Switch(DatePart
('q',[DateIssue])=1,"One",DatePart('q',[DateIssue])=2,"Two",DatePart
('q',[DateIssue])=3,"Three",DatePart('q',[DateIssue])=4,"Four"),
tbl_CPM.DateIssue
HAVING (((tbl_CPM.DateIssue) Between
[Forms]![frm_CPM_QTR_Parameter]![StartDate] And
[Forms]![frm_CPM_QTR_Parameter]![EndDate]));

I am filtering on the date the PO was issued.  The date field in the table
is a medium date format.

To trigger the quarterly reports we need, I made an opening form with 2
unbound text boxes called StartDate and EndDate.  Once the user enters
those dates, there are button choices to open a report, export to excel or
email the report.  The event procedures on these forms open appropriate
form/report with underlying queries using 'Between
[Forms]![frm_CPM_QTR_Parameter]![StartDate] And
[Forms]![frm_CPM_QTR_Parameter]![EndDate]))' as their parameter.

I used to have the start date/end date showing in the header, it worked
fine.  Only problem is the report requestor wanted the title to read:
__QTR__ Quarter __YR___ Report instead of what I had set up.  This whole
set up is a new report we are doing each quarter, so on the first one I
just changed the header.  This one I also changed it to read Second
Quarter, but since it will be a regular thing, I want to automate it so
others can run the report and not have to worry about changing the header.
I have 2 unbound text boxes in my report with control source(s)
"=Forms!frm_CPM_QTR_Parameter!StartDate" and end date.  I can format the
year one ok and was going to tie them to the query based on the correctly
formatted quarter date you helped me with, but I can't get the query to
return just one date and I tried to format the unbound text box but all I
can get it to do is show the number of the quarter, not the text.

Hope this helps, thanks, Cathy


 

                      James LaBorde

                      <jlaborde@xxxxxxxxx      To: "'mso@xxxxxxxxxxxxx'"
<mso@xxxxxxxxxxxxx>                         
                      >

                      Sent by:                 cc:

                      mso-bounce@freelist

                      s.org                    Subject:  [mso] Re: Access
2002: Convert Number To String (Quarterly) 
                      07/13/2004 05:42 PM          :VSMail mx4

                      Please respond to

                      mso
..... 
 

 





Cathy,

How are you grouping these?  If you are asking for unique values, the whole
thing has to be unique, not a single field.  What data are you trying to
get?  An Aggregate query may be what you need.  Can you tell us what kind
of
data you are filtering and what exactly you are trying to get out of it?

James

-----Original Message-----
From: Cathy.Evans@xxxxxxxxx [mailto:Cathy.Evans@xxxxxxxxx]
Sent: Tuesday, July 13, 2004 12:22 PM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access 2002: Convert Number To String (Quarterly)
:VSMail mx4



Thanks Jim.  I'm  saving this, as I have not been able to write a correct
nested IIf statement yet, just don't seem to get it!  Am going to use the
Switch function James sent for this one, however now a new problem has come
up.  This converted format was for a report header, it is a sub report with
the underlying query showing which quarter, and the year.  The underlying
query is returning multiple instances of the quarter/year though I've
grouped the fields and set unique values to yes.

I'm thinking it is grouping based on the actual date, not the converted
quarter result so I get 80 rows of second quarter 2004.  I have the date
field filtered by "Between [Forms]![frm_CPM_QTR_Parameter]![StartDate] And
[Forms]![frm_CPM_QTR_Parameter]![EndDate]", which is a date range inserted
in a form that opens the whole set of reports.  This header was supposed to
be the final aspect so I didn't have to rename each report to show what
quarter was being reported.  But this new problem is making me balder . . .
:(

Am I complicating things too much trying to find the solution?  My original
report header used to have 2 unbound text boxes with these respective
control sources "=Forms!frm_CPM_QTR_Parameter!StartDate" and
"=Forms!frm_CPM_QTR_Parameter!EndDate".   It showed the actual start/end
dates the user entered in the first form.  But instead of full dates, I'm
needing it to show quarter/year.

 Instead of trying to get the query to return a single result based on
quarter/year and place that result in the header, could I apply the same
formatting idea to these unbound boxes so the first box would show the
quarter and the last box the year?

Thank you, Cathy





----------------------------------------------------------------------------
-------------------------
The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential
and/or privileged material. If you are not the intended recipient 
of this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any
action taken in reliance upon this message is prohibited. If you 
received this in error, please contact the sender and delete the 
material from any computer.  Any views expressed in this message
are those of the individual sender and may not necessarily reflect 
the views of the company.  
----------------------------------------------------------------------------
---------------------------

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes)
in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts:

  • » [mso] Re: Access 2002: Convert Number To String (Quarterly) :VSMail mx5