Results 1 to 3 of 3
  1. #1
    siliconfiber is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    2

    Display all rows containing same contactid only.

    Access newbie.... that being said!!

    I am trying to display in a list box only the rows matching the current "contactid" field being displayed in the form that is active. Would this be a query and what would the code behind it be.



    Thanks in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,973
    All this is on the same form? This would be an SQL Select statement in the ListBox RowSource property that references the ID field of the current record.
    SELECT fieldname FROM tablename WHERE ID=Forms!formname![ID]
    Then need code (I use VBA but suppose macro could do this) in the form's OnCurrent event to requery the listbox when navigating between records of the form.
    Private Sub Form_Current()
    Me.listboxname.Requery
    End Sub

    An alternative is a subform instead of listbox. The Master/Child link properties of the subform container control would synchronize the records. No code required.
    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
    siliconfiber is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    2
    Thank you for the help, just getting back to this... it worked just fine.

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

Similar Threads

  1. Query only certain rows?
    By 10 Gauge in forum Queries
    Replies: 48
    Last Post: 03-22-2011, 01:05 PM
  2. combine rows
    By summerAIS in forum Queries
    Replies: 3
    Last Post: 07-31-2010, 10:13 PM
  3. Report control of a field display/no display
    By systems013 in forum Reports
    Replies: 5
    Last Post: 02-01-2010, 09:44 AM
  4. Replies: 2
    Last Post: 10-16-2009, 01:58 PM
  5. Counting rows
    By anishap in forum Access
    Replies: 0
    Last Post: 10-08-2008, 10:41 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