Results 1 to 5 of 5
  1. #1
    snorbs is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    2

    Question using combo box to select records


    Hello,
    I am new to this forum and am need of some expert help.
    I am trying to create a database for a gymnastic class. I have created tables to show classes and badges passed (which are multiple records).What I wish to do is create a form that the gymnasts name would be in the header(combo box) and that when the gymnast was selected the corresponding information would change. however I have created this all but it does not seem to tie up together. As you can possibly guess I am a complete novice to this so if you can help with my problem this would be greatly appreciated..

    Many thanks for your time

    Snorbs

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you need a form and subform. The parent form is a single record of the gymnast.
    The subform would be their classes/badges table. (bind the subform to the parent on ID)
    put an unbound combo box in the parent form header. The query has ID, NAME. (hide the ID, col1.width=0)

    then in the afterupdate event of the combo, filter the form:

    Code:
    sub cboName_afterupdate
    if isNull(cboName) then
       me.filterOn =false
    else
       me.filter = "[ID]=" & cboBox 
       me.filterOn =true
    endif
    end sub

  3. #3
    snorbs is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    2
    Hi Ranman256,

    Thanks for your quick response and help with my problem.it was not till I got your response that I realised that I my have sent my thread trough to the wrong place as this is maybe too easy for you guys who do programming. So Thanks.
    any how I have carried out your instructions to the best of my ability but am getting an error.

    A runtime error 3075 and is flagging up

    Me.Filter = "[ID]=" & cboBox

    as I said earlier this is well above my knowledge of access as I have never used code before so apologies if its a simple fix.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The sub is called cboName so I presume that is the name of your combobox? In which case:
    Me.Filter="ID=" & Me!cboName

  5. #5
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Here is a tutorial that may be helpful. It was designed in an older version of Access, but the concept is the same.

    http://www.datapigtechnologies.com/f...tomfilter.html

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

Similar Threads

  1. Replies: 3
    Last Post: 08-31-2014, 01:38 AM
  2. Replies: 3
    Last Post: 06-09-2013, 05:35 PM
  3. Replies: 2
    Last Post: 05-28-2013, 04:00 PM
  4. Replies: 4
    Last Post: 10-18-2010, 09:44 PM
  5. Replies: 47
    Last Post: 06-17-2010, 03:04 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