Results 1 to 3 of 3
  1. #1
    dahl0000 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    2

    Make a field in a form display a certain value

    I collect records from multiple counites and I need a way to see what the last record from each county was collected on a form. I created a query called LastRecord and put a Top Value Rule of 1. I then created a form based on the query. In that form I want a field to show the last record and date collected for a particular county. I will be having multiple fields for many different counties on that form. Can I filter the query by using the control source in the field? Or how can I change the criteria of the query for each field?



    Thank you

    Kris

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    filter records with a combo box
    Code:
    private cboBox_Afterupdate()
    if isNull(cboBox) then
       me.filterOn = false
    else
       me.filter = "[field]='" & cboBox & "'"     'view only this county
       me.filterOn = true
    endif
    or load the record based on the last record (largest Index)
    Code:
    private cboBox_Afterupdate()
    dim vID
    if isNull(cboBox) then
       me.filterOn = false
    else
       vID = dMAx("[ID]","qsQryOfItems","[County]='" & cboBox & "'")   'get the last record
       me.filter = "[RecID]=" & vID
       me.filterOn = true
    endif

  3. #3
    dahl0000 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    2
    Thank you!

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

Similar Threads

  1. Replies: 3
    Last Post: 10-28-2015, 12:38 PM
  2. Replies: 5
    Last Post: 09-25-2014, 08:33 PM
  3. Replies: 5
    Last Post: 06-11-2012, 08:47 AM
  4. Replies: 7
    Last Post: 11-07-2011, 06:31 AM
  5. Replies: 3
    Last Post: 02-01-2011, 09:47 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