Results 1 to 6 of 6
  1. #1
    JeRz is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    33

    Searching for records

    Hi everyone,

    I am unsure how to proceed with this step. I have a database that I am starting the user off on a form "FamFind" where they need to enter a 5 digit ID number. The Text box for this is unbound and the name is "FamIDS". I need this to search the table, "Family" and the field "Family_ID". The field is set as a long integer.

    How can I have the user input value on the FamFind form look for a record and, if found, pass the record to the "Family" form? In addition, if the record is found, can I use an OpenForm command to open a designated form such as "patient"? If no record is found, can it then display the "AddFamily" form?



    I was trying to accomplish the first part of this by using a DCount expression but I have been unsuccessful most of the day attempting to tweak things. I can provide code if need be. I don't have it available at the moment.

    Thanks for any help!

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Did you consider making the FamIDs control a combo box or list box instead? That way, if the id does not exist, you eliminate a bunch of work with respect to
    - having a query that uses the unbound control as criteria,
    - having to deal with the fact that the form did not open with a record but
    - then needs to be requeried against the entered id and
    - then needing to decide on what to do if there is no result versus what to do if there is
    Most of that can be avoided. If the desired id cannot be found in the list, you simply provide a process to add a record on that form or open any other if that's what you want.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    JeRz is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    33
    Quote Originally Posted by Micron View Post
    Did you consider making the FamIDs control a combo box or list box instead? That way, if the id does not exist, you eliminate a bunch of work with respect to
    - having a query that uses the unbound control as criteria,
    - having to deal with the fact that the form did not open with a record but
    - then needs to be requeried against the entered id and
    - then needing to decide on what to do if there is no result versus what to do if there is
    Most of that can be avoided. If the desired id cannot be found in the list, you simply provide a process to add a record on that form or open any other if that's what you want.
    Thank you for the response, Micron. Would a combo box or list box work even if there could be 1,000+ family IDs?

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    JeRz,

    Do you really expect users to enter a 5 digit ID number to find a specific record? What makes that the only, or optimal search?
    Further to Micron's comments, have you considered using LastName and/or FirstName (and other info) with a Find as you type approach?

    Can you describe more details of what you are searching for and why?

    Entering a 5 digit code seems like entering a random number. I don't see users memorizing or becoming familiar with several such codes. To make the search more friendly to the user, use terms/fields/values that are familiar to them.

    Good luck.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I don't see users memorizing or becoming familiar with several such codes.
    You never know. I know from experience that a seasoned parts department counter person typically knows a huge number of stock codes if they give them out often enough.
    JeRz: I wouldn't suggest a combo for 1,000+ rows simply because it's a bit awkward for a list that size (IMO) although it can handle it. However, there is an Access option for which you'd have to be careful of - 'don't show lists for more than x records' or something like that. The default is 1000 rows. AFAIK, a listbox has no such limitation.
    Orange has a point. If you elaborate on the process, we might be able to suggest better search methods. The more info you supply about this, the better our chances of making good suggestions. Even 1000 rows is too much to scroll through. The suggestion of applying a filter as you type is a good one, and is common too. It can even be applied to a list or combo box if you don't want to be altering a visible record list as you type.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Sounds like the number might be known to the family such as printed on a bill or form like an Account number etc. We do this to allow patients to pay bills. If that is the case, then you will have one text box like you suggested and once they enter value, have a button to hit. In code on this button you can do a DLookup of the number in your table, if not found open the AddFamily form,(Docmd.OpenForm "myform") or if found open the Patient form, etc.

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

Similar Threads

  1. Searching through records on a form
    By Wagon in forum Forms
    Replies: 2
    Last Post: 04-22-2016, 07:14 AM
  2. searching through records
    By lonesoac0 in forum Access
    Replies: 2
    Last Post: 04-20-2016, 10:30 AM
  3. DAO ADO and Query for searching records
    By TioAdjie in forum Forms
    Replies: 12
    Last Post: 02-20-2014, 08:16 PM
  4. Replies: 10
    Last Post: 01-10-2011, 07:52 PM
  5. Searching records....
    By knightjp in forum Database Design
    Replies: 0
    Last Post: 01-07-2009, 05:20 AM

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