Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 MS Access Date Query

Author  Topic 

D0LeM1Te
Starting Member

3 Posts

Posted - 2004-10-05 : 14:30:46
Hey,
I'm working on a database for my internship which stores information about students registering for a school & the date they registered. My Question is 2 fold

1st:
I need to make a Query that finds all students that registered within a certain year. The Registration date field's format is MM/DD/YYYY. I tried the two methods pasted beow but they didnt quite work out

SELECT *
FROM Student_Data
WHERE Registration_Date BETWEEN (01/01/2003) And (12/31/2003);

& this 1

SELECT *
FROM Student_Data
WHERE Registration_Date BETWEEN (01/01/2003) And (12/31/2003);


2nd:
The database is run in a form. How do I make it so that the queries are displayed in the form & not in a table??

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-10-05 : 14:46:58
Is the backend access or SQL ?


SQL =

SELECT *
FROM dbo.Student_Data
WHERE Datepart(year,Registration_Date) = '2003'

Access =

SELECT *
FROM Student_Data
WHERE (((Year([Registration_Date]))=2003));



Jim
Users <> Logic
Go to Top of Page

D0LeM1Te
Starting Member

3 Posts

Posted - 2004-10-15 : 09:39:29
Thanx alot Jim.. That worked perfectly... I'm still researching how to return the queries into the form. If anyone can point me in the right direction it will be greatly appreciated

Kunle
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-15 : 09:43:13
dates are delimited in Access with #.

SELECT *
FROM Student_Data
WHERE Registration_Date BETWEEN #01/01/2003# And #12/31/2003#

- Jeff
Go to Top of Page
   

- Advertisement -