[mso] Re: Access: Converting Date To Year For Parameter Look Ups

Jim, thank you.  I made the below changes to the sample database and it
worked.  Fantastic.  Next step was to transpose the success to my table,
etc.  Got the drop down arrow to return only the 4 yr dates entered, but
when I tried to open the report got a 'value entered isn't valid for this
field' error saying 'you may have entered text in a numeric field or a
number that is larger than the FieldSize setting permits.

So I decided to copy my data to the tblPatientInformation table to try to
fool it :-).  It wouldn't copy, and I noticed in the design view that
Rogers sample database had the following filter in the date/time field:
99/99/00;0;_.  When I put a date in that field, it makes the year a 4 digit
year.  I remember recently finding a setting in my Access, I thought in
tools/option, that set all dates to view as 4 digit.  At the time I told it
yes, but now I'd like to toggle that setting off and see it it's causing
problems but I can't find it.

The below works perfectly within Rogers database, so if I can't find the
problem in mine, I'm thinking of using the one I revised per your
instructions and importing my data into his preformatted table and
importing all my forms/reports/queries and go from there.  There could be
some problem with my original table, otherwise why would it work in one
database and not another?  Anyway, I greatly appreciate all your help,
there is so much to learn!

Hope I haven't confused you further, I know I'm already there!
Regards, Cathy


                                                                                
                                          
                      "Jim Pettit"                                              
                                          
                      <j_e_pettit@hotmail      To: <mso@xxxxxxxxxxxxx>          
                                          
                      .com>                                                     
                                          
                      Sent by:                 cc:                              
                                          
                      mso-bounce@freelist                                       
                                          
                      s.org                    Subject:  [mso] Re: Access: 
Converting Date To Year For Parameter Look Ups 
                      02/24/2004 01:57 PM                                       
                                          
                      Please respond to                                         
                                    ..... 
                      mso                                                       
                                          
                                                                                
                                          
                                                                                
                                          




Cathy--

Now I'm a bit confused (a feat which is admittedly not that hard to do);
If your query returns just the rows you showed me, there are no dates
not in 2001. Anyway, I went and downloaded the Rogers Access DB to which
you linked, and did the following to produce the results I think you
want:

1) In the RecordSource behind the report 'PatientDemographics', change
the WHERE clause to the following:
WHERE (((DatePart("yyyy",[Birthdate])) Like
[forms]![rpfPatientDemographics (parameter form)]![cboSelect]));

2) For the control 'cboSelect' on the form 'rpfPatientDemographics
(parameter form)', change the ColumnCount to 1, and the ColumnWidths to
1".

3) Change the RowSource for 'cboSelect' to the following:
SELECT "*" AS BD4 FROM tblPatientInformation
UNION
SELECT DatePart("yyyy",[Birthdate]) AS BD4 FROM tblPatientInformation;

When you run the report, the parameter form is called, and passes either
a 4-digit year or an asterisk onto the report, which is then used in the
WHERE clause.

Whew. I realiz this doesn't handle the '1905' issue; I'm guessing that's
a data error. But, once you get that problem licked, I believe this'll
work for you. Hope this helps...

--Jim

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Cathy.Evans@xxxxxxxxx
Sent: Tuesday, February 24, 2004 10:24 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access: Converting Date To Year For Parameter Look
Ups



Frankly, I'm not sure of anything these days! :) However, I don't see
that date stored in any of the rows.

The query you gave me below returned the following.  Maybe I'm not
approaching the whole idea right.  I really wanted to just put a
parameter form before the report so the user could choose the year and
have only that year show on the report.  Found a sample database  in
Rogers Access Library at
http://www.rogersaccesslibrary.com/download3.asp?SampleName=ChooseReport
FromList2.mdb

and adjusted the below database with my tables, queries and reports so
that my year returns on the dropdown parameter form that opens the
report.  Had no problem when I converted it to run a report based on the
parameter of class type but when I wanted to duplicate that idea and
give them a drop down to search by year, no luck on that one.  Thanks
for hanging in there with me . . .


 ChooseReportFromList2-2k.zip





12-Jun-2001
13-Jun-2001
14-Jun-2001
03-Oct-2001
25-Oct-2001
06-Nov-2001
07-Nov-2001
14-Nov-2001
03-Dec-2001
04-Dec-2001
06-Dec-2001




                      "Jim Pettit"

                      <j_e_pettit@hotmail      To: <mso@xxxxxxxxxxxxx>

                      .com>

                      Sent by:                 cc:

                      mso-bounce@freelist

                      s.org                    Subject:  [mso] Re:
Access: Converting Date To Year For Parameter Look Ups
                      02/24/2004 12:39 PM

                      Please respond to
....
                      mso









Cathy--

The date/time format on the date field (as seen in table design view)
only affects the presentation of the date; the actual date is stored in
the database as a number, regardless of format. So that's not the
problem. If you're returning '1905', have you checked your record to be
*sure* you don't have that date inadvertently stored in one or more
rows? To check, you can run a query like the following:

SELECT DISTINCT ClassCompleted
FROM tblClassInformation
WHERE ClassCompleted < #12/31/2001#;

I'm interested to hear what shows up...

--Jim

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Cathy.Evans@xxxxxxxxx
Sent: Tuesday, February 24, 2004 9:22 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access: Converting Date To Year For Parameter Look
Ups



Making progress . . . this returns 4 rows of 1905 as the year.  I have
dates ranging from 2001 to 2004, so I am looking for only 4 rows
returned, but how is it returning 1905? I've got the field in the table
as date/time, medium format, I don't want it formatted as year on the
main table.  Is that causing a problem?  Thank you again, 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). http://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).
http://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
*************************************************************







-----------------------------------------------------------------------------------------------------
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).
http://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: