Defining Query Filters From A Form

GarageFlower

Registered User.
Local time
Today, 13:48
Joined
May 20, 2004
Messages
108
I have a database about when computers have been installed

I have a form
It has a drop down list with Januray through to December

I want the user to select a month and a year and then click the command button and it will run a query displaying all the computers installed in the month of that year

any ideas people?
 
SELECT * from MyTable Where Month([Installed]) = Forms!MyForm!MonthSelected and Year([Installed]) = Forms!MyForm!YearSelected

As one way
 
I could try that but the field the users enter would be for example

28/11/05 for the date installed

I want to run a query which shows all the computers installed in january
from a combo box which just lists all the months
 
FoFa said:
SELECT * from MyTable Where Month([Installed]) = Forms!MyForm!MonthSelected and Year([Installed]) = Forms!MyForm!YearSelected

As one way

How exactly would i implement this
Could you upload an example please?
 
OK, just extract the month and year from their date.
SELECT * from MyTable Where Month([Installed]) = Month(Forms!MyForm!DateSelected) and Year([Installed]) = Year(Forms!MyForm!DateSelected)
 

Users who are viewing this thread

Back
Top Bottom