Results 1 to 6 of 6
  1. #1
    Pam Buckner is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    12

    Search Form

    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?

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    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

  3. #3
    Pam Buckner is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    12
    How do I bind the control to the first column of the combo box?

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Open the properties for the combo box. On the data tab, put the number 1 i in the row Bound column

    Alan

  5. #5
    Pam Buckner is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    12
    I'm not clear on where this part is supposed to go on the query:

    FROM tableName
    Where Month(tableName.Birthdate) = Forms!frmName!comboBoxName

  6. #6
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    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

Please reply to this thread with any new information or opinions.

Similar Threads

  1. form search
    By ashwin09 in forum Code Repository
    Replies: 2
    Last Post: 10-13-2013, 08:47 AM
  2. Search Form
    By whojstall11 in forum Forms
    Replies: 28
    Last Post: 07-06-2012, 08:27 AM
  3. Search Form
    By roger556 in forum Forms
    Replies: 5
    Last Post: 07-16-2011, 02:11 PM
  4. Search form
    By NISMOJim in forum Forms
    Replies: 9
    Last Post: 05-06-2011, 12:25 AM
  5. Replies: 9
    Last Post: 02-15-2011, 03:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums