Results 1 to 4 of 4
  1. #1
    krayav is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    2

    Search function in an Access 2010 form where the fields are populated from the bound table

    I created a form for some Liaisons to use when they visit Dr.s offices. They will visit many of the same Dr's offices over and over again so I want to them to pull up information from their last visit with all the contact information for the physicians.
    I have my form split into two sections:
    The first section has the name of the office, address, and other things that don't usually change. The second section has fields relevant to their current visit.
    I want them to be able to search with the practice name and pull up, into the form, everything they did from the last visit. I already created a button to clear the second half once they have looked over everything they did during their last visit.
    Any help is greatly appreciated.
    I should also mention that I am new to Access so please be patient if I don't understand immediately.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Finding the most recent record can be tricky. Options:

    1 Domain Aggregate function DMax that pulls the latest date or record ID from the table for a patient and uses that as criteria to filter records

    DMax("ID", "Visits", "PatientID=" & Me.PatientID)

    that assumes the record ID is always increasing for each new record

    or

    DMax("VisitDate", "Visits", "PatientID=" & Me.PatientID)

    2. TOP N qualifier in query http://allenbrowne.com/subquery-01.html#TopN
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    krayav is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    2
    Thank you for replying.

    I have attached a picture of the form I am talking about. I looked up DMAX but it looks like you have to write a code with the id number or the exact search field ( I could be mistaken). I would like the people liaisons to enter the practice name and pull up the information from the table. I'm okay if the search pulls up the table and they have to select the field to populate into the form.


    Click image for larger version. 

Name:	form.PNG 
Views:	5 
Size:	9.7 KB 
ID:	22110

    Sorry if I don't get this immediately.

    Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, user can select the practice name and code will pull the last record for that practice - review http://www.allenbrowne.com/ser-62.html.

    The Practice Site Name combobox can have the PracticeID as one of the columns. If you need to know how to build multi-column combobox, review http://datapigtechnologies.com/flash...combobox3.html

    So the code to pull the most recent visit record for a practice could be like:

    Me.Filter = "VisitID=" & DMax("VisitID", "Visits", "PracticeID=" & Me.cbxPractice)
    Me.FilterOn = True

    Controls used for input of filter criteria must be UNBOUND.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Total Bound Field in a Form in Access 2010
    By ryanmce92 in forum Forms
    Replies: 9
    Last Post: 04-29-2015, 10:48 AM
  2. Replies: 1
    Last Post: 11-29-2013, 08:35 AM
  3. Replies: 1
    Last Post: 11-28-2012, 01:01 PM
  4. Table fields populated from query
    By jcarstens in forum Access
    Replies: 1
    Last Post: 04-08-2012, 05:55 PM
  5. Replies: 8
    Last Post: 02-19-2012, 03:48 PM

Tags for this Thread

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