Results 1 to 3 of 3
  1. #1
    kiri19 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    18

    Populate a subform according to selections made in a combobox on the main form

    This is my first project with access
    I am working with access 2010 and I am trying to populate a subform "subfrmVisits" according to selections made in a combobox "cboSearch" on the main form "frmClientInfo"
    The subform "subfrmVisits" is based on a query: SELECT Visits.Visit, Visits.Need, Visits.[New Client], Visits.[Client ID], Visits.ID
    FROM Visits
    WHERE (((Visits.[Client ID])=[Forms]![frmClientInfo]![cboSearch]));

    In the AfterUpdate event of the "cboSearch" combo I have :

    Private Sub cboSearch_Afterupdate()
    Me.subfrmVisits.form.requery
    End Sub

    In the debug window [Forms]![frmClientInfo]![cboSearch])) returns the client ID that matches the selection in the combobox ,
    but the subform is always blank.


    The link master/child fields for the subform are set to Client ID.

    Thank you in advance!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If the Master/Child links are set to ClientID then the WHERE clause is not needed in the subform RecordSource and code to requery subform is not necessary.

    Search the main form for the client record and the subform visit records will tag along. Several ways to accomplish.
    1. filter the form
    2. go to desired record
    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
    kiri19 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    18
    I set the master(the combo)/child link(cliendID) appropriately and it worked fine , the criteria was not needed and also the query to create the subform was not needed, the record source forms itself when the subform is created...i am getting a grasp of all these things......i am used to oracle...so this is new to me.Thanks a lot for the help.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  2. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  3. Subform Combobox based on Main form combo box
    By accessmom in forum Forms
    Replies: 5
    Last Post: 02-21-2011, 07:02 AM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 7
    Last Post: 05-24-2009, 10:24 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