1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

MS Access searching on Age

Discussion in 'Business Applications' started by Erm, Jan 15, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    I have a contacts database and I have an Age field in a form which is based on a query. The Age is calculated in the query qryContactDetials and presented in the form TESTSearchfrmContactDetails. The form opens up in the Filter By Form mode to be used as a search form.

    The issue is that I want to be able to search on Age in the form using things like >65, but it isn't working. It lists date in the drop down for Age on the form. Where am I going wrong?

    Please help!

    Debbie
     

    Attached Files:

    • Test.zip
      File size:
      188.6 KB
      Views:
      13
  2. draceplace

    draceplace

    Joined:
    Jun 8, 2001
    Messages:
    2,583
    I can't seem to use your form. Age drop down is null or not null and when I select one it blows up/shuts down.
     
  3. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    I replaced the database just after posting...does it do it on the one attached now?
     
  4. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    I just checked...no idea what happened, but this should be doing what I said and hopefully not crash!
     

    Attached Files:

  5. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Sorry I can't open your database. I assume it is Access 2010.
    I would create a table, query & form to maintain a set of Ages ranges like <30 30-60 >60 etc for your combo.
    I would then have 2 more fields (not seen in the combo) for Start and Finish ages so for <30 it would be 0 and 30 or 0 & 29 depending on whether or not 30 is "Inclusive".
    30-60 would be 30 and 60.
    >60 would be 60 and 200.
    I would then use those values to populate 2 fields on your "Age Selection Form" and use those with the query as Criteria for use with
    Between forms![formname]![startfieldname] And forms![formname]![finishfieldname]
     
  6. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    I need to be able to specify different ages sometimes it might be 20-30, >65, <65 or any other range or greater than/less than. What did I need to do so you could open it again OBP?
     
  7. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You could try saving in Access 2007 format, but that is not always successful either.
    It might be I will have to provide an Access 2003 or 2007 database for you to import that database objects in to.
     
  8. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    It won't save as an mdb...not sure which bits are not compatible
     
  9. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    Here is a basic version in a format you should be able to open, but now I cannot get it to filter by form...?!
     

    Attached Files:

  10. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    So where on the form do you want the Age search parameters to be and how will you display the results?
     
  11. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    I want to be able to filter by form and display results in the form.
     
  12. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Under those circumstances it would make sense to use a VBA set form filter rather than trying to do this in the query as I thought you wanted to do.
    I can create some VBA code to do that, however I will need to add fields and an Option Group to the form.
     
  13. Erm

    Erm Thread Starter

    Joined:
    Jul 30, 2003
    Messages:
    298
    Any help would be greatly appreciated!
     
  14. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1085304

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice