I have a contact list database that includes a field called Birthdate. I have a report that shows all birthdays grouped by month. Now I want to create a search form that allows users to see all birthdays in a given month. Can anyone help?
I have a contact list database that includes a field called Birthdate. I have a report that shows all birthdays grouped by month. Now I want to create a search form that allows users to see all birthdays in a given month. Can anyone help?
1.Create a combo box with the month names and their corresponding values:
1, January
2, Feburay
etc
2. Bind the control to the first column.
3. Create a query (name it whatever you want):
SELECT (whatever fields you want)
FROM tableName
Where Month(tableName.Birthdate) = Forms!frmName!comboBoxName
4. create a subform on your main form and use the query above as the data source
5. in the AfterUpdate Event of the combobox, go to the VBA editor and type in:
Me.subFormName.Form.Requery
That should be it
How do I bind the control to the first column of the combo box?
Open the properties for the combo box. On the data tab, put the number 1 i in the row Bound column
Alan
I'm not clear on where this part is supposed to go on the query:
FROM tableName
Where Month(tableName.Birthdate) = Forms!frmName!comboBoxName
If you are working in the QBE, then in the criteria for the field Birthdate, type
=Forms!frmName!comboBoxName
Make sure you change the generic table and field names to those that you are using of it will not work.
To see this all in SQL, after you type in the criteria, open the SQL window (upper Left corner there is a drop down arrow) and it will be there for you. The WHERE statement is your criteria.
Alan