UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Query that can recognise 'Month' input parameter.    
 
   
emphasis1979
post Jun 9 2005, 04:31 AM
Post #1

UtterAccess Enthusiast
Posts: 63



hello there,

I'm trying to create a query for a training course database. The courses are booked in on specific dates, but the same course can take place on multiple dates. i want to set a date parameter which will tell me what courses are due to take place in a particular month. for example, i type in 'July' and it tells me what courses are due then. I think I will also have to add the year as well.

is this possible? i don't find date functions in Access particulary easy, so any advice much appreciated.

thanks,

e1979
Go to the top of the page
 
+
ecscmb
post Jun 9 2005, 04:37 AM
Post #2

UtterAccess Addict
Posts: 115
From: Sunny Devon



In your query after adding the fields you wish to see add a new field as follows:-

Field: MonthofCourse:format(Month([CourseDate]),"mmmm") - coursedate is the date the course is taking place
Show: either ticked or not depending if you want to view the month
Criteria: [Please enter month] - or similar

This should work for you.

Chris
Go to the top of the page
 
+
ecscmb
post Jun 9 2005, 04:40 AM
Post #3

UtterAccess Addict
Posts: 115
From: Sunny Devon



Oops forgot about adding the year.

Either:-

format(month([Date]),"mmmm" & " " & format(year([Date]),"yyyy")
Criteria [Enter month and year] - ie June 2005

or

Add an extra field to test the year in a similar way to the month

Chris
Go to the top of the page
 
+
emphasis1979
post Jun 9 2005, 05:07 AM
Post #4

UtterAccess Enthusiast
Posts: 63



hello there,

thanks for the advice. i see in principle what its trying to achieve. its not returned the correct results though? the results are in fact pretty random?

will the format of my CourseDate effect the format?

e1979
Go to the top of the page
 
+
emphasis1979
post Jun 9 2005, 05:10 AM
Post #5

UtterAccess Enthusiast
Posts: 63



just to add, for every date, it only offers January or December as the Month?

any ideas?
Go to the top of the page
 
+
emphasis1979
post Jun 9 2005, 05:12 AM
Post #6

UtterAccess Enthusiast
Posts: 63



and!

when i try the 'Year' version of the same expression, it always returns "1905"

odd?
Go to the top of the page
 
+
ecscmb
post Jun 9 2005, 05:42 AM
Post #7

UtterAccess Addict
Posts: 115
From: Sunny Devon



Odd i got the same when i ran it through properly. I think it is something to do with English and American Dates.

Anyway i have created a sample which is attached an appears to work. The only thing is you have to enter the Numeric month not the text.

I should have cheked before i posted!
Go to the top of the page
 
+
emphasis1979
post Jun 9 2005, 06:12 AM
Post #8

UtterAccess Enthusiast
Posts: 63



have tried it and its working well,

many thanks for your efforts!

e1979
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 02:15 PM