By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,477 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,477 IT Pros & Developers. It's quick & easy.

Date Query

P: 1
I have a DB table with member information. Two of the fields are Contracts Start Date and Contract End Date. I am querying by form and want to enter just the year (IE. 2008) and have the query return all contracts active in that year. I am still a newbie at this so be gentle.

Thanks
Jan 22 '08 #1
Share this Question
Share on Google+
1 Reply


MindBender77
100+
P: 234
I have a DB table with member information. Two of the fields are Contracts Start Date and Contract End Date. I am querying by form and want to enter just the year (IE. 2008) and have the query return all contracts active in that year. I am still a newbie at this so be gentle.

Thanks
You could design a query with the date in your "Where" clause and use Like to search for it. You have to design a custom input mask on your form like \*9999\*;0;

The query can be structured like so:
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.Field1, Table1.Field2, Table1.Field3
  2. FROM Table1
  3. WHERE (((test_table1.Contract_Start_Date) Like [Forms]![frm_testing_application]![Textbox1]))
  4. GROUP BY Table1.Field1, Table1.Field2, Table1.Field3;
  5.  
This query will look in Textbox1 on your form which should look like:
Ex. *2007*

Hence, it will look for the year only. I believe there are several different ways of performing this same task.

Hope this Helps,
JS
Jan 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.