Results 1 to 3 of 3
  1. #1
    Jigreel409 is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Oct 2013
    Posts
    2

    Using a search for records in a form based on a lookup field.


    I'm using Access 2013. I have two tables - "UniversityNames" table and a "StudentNames" table. A third table "Student_University" table is a junction table to record all the universities that a given student applies to. I have a FORM for the "Student_University" table and am using a Lookup for the student names and a lookup for the university names. I have additional fields in this junction table to record pertinent information about each record, such as scholarships granted, etc. The drop-down list for the student's name field in the form and the university name field in the form are quite large, requiring a lot of scrolling each time I wish to add a bit of information to the table via the form. I am in need of a search feature in the form to find a specific student's name or a specific university name. I have tried what is suggested, to create a search by using a combo box's third choice, "Find a record on my form based on a value I selected in my combo box." This will not work for me, I guess because the value is coming from a lookup field on the form. It works fine when I set it up on a non-lookup field. Any suggestions what I might do to make it work? Thank you.

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Have a look at the attached.
    The student table is large. When the combobox is selected, you can start typing and the combobox will auto search to your keystrokes - no need to scroll down.
    The junction table for university/student includes fields for data pertaining to that particular student at that particular university.

    Replaced v01 attachment with v02 which includes a combobox for the university lookup.
    Last edited by davegri; 09-08-2018 at 05:01 PM. Reason: new attachment

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    ...am using a Lookup for the student names and a lookup for the university names...
    ...It works fine when I set it up on a non-lookup field.
    Sounds like you are saying the table is where the lookup field is. If so, then unless you plan to work directly in tables (which isn't always a great idea) table lookup fields should generally be avoided. The main issue is that the value seen is of course a value from the data source, but what Access stores is the index number for that value. Possibly that value can be used when the lookup is based on another table, but when it's a multi value field, the index is hidden and you cannot get at it.

    Sticking with the assumption you have a table lookup field, you may have to use the .Value property to retrieve the actual value that you see in such a table field. However, I've never tried to access that in a form control record or row source - only in a query. Sorry if I'm way off base, but "doesn't work" doesn't reveal anything of value. In this case you could mean you get the idex value (a number) or nothing at all, or maybe even an error.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-20-2018, 11:21 PM
  2. Replies: 11
    Last Post: 11-19-2013, 09:03 AM
  3. Replies: 4
    Last Post: 07-11-2012, 10:31 AM
  4. Replies: 1
    Last Post: 02-29-2012, 10:13 PM
  5. Find records based on a field in a form
    By rbw95662 in forum Programming
    Replies: 3
    Last Post: 06-15-2010, 04:12 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