Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2004
    Posts
    41

    Question Unanswered: Form and linked subform combobox Issue

    I have a form linked to a table.

    Inside, there is a subform taking rows, and it is linked by id to the main form.

    When I scroll with my mouse for example, Everything is working, I can see the
    data in the subform is moving currectly one by one.

    Now I want to add a combobox to the top of the main form. Did it, linked it
    to the list of options in the main table, but I have no idea how to make it
    change the subform results when it is changed.

    Simply put, when the combo is changed, it should relaunch the subform
    query in addidtion to 'Where id=combo.value' .

    Simple, but I have no idea how to implement this.

    Ideas? :P

    Thank you!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    one way would be to insert into the combo/list boxes on change event some code to set a filter on the parent form

    you need to set the filter and then turn the filter on
    HTH

  3. #3
    Join Date
    Dec 2004
    Posts
    41
    I thought so, I knew it has to be related with the filter.

    But I have no idea of how i'm doing this. Can you show/link me to examples?

    Thanks for your reply.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    in the combo box's on click event

    Code:
    me.filter= "[mycolumname]="  & mycombo.column(?) 
    or 'for character (string / text columns)
    me.filter= "[mycolumname]=" & chr$(34) & mycombo.column(?) & chr$(34)
    
    me.filteron=true
    where
    mycolumname is the name of the column / field in the forms underlying table/query
    mycombo is the name of the combobox
    .column(?) is the index to the column in the combobox that has the data you require (usually this will be 0, in which case you can use the default mycombo, rather than expressly referring to the column)
    the character (string/text columns) can use any valid sql clause
    eg
    me.filter= "[mycolumname] like " & chr$(34) & mycombo.column(?) & "*" chr$(34)
    HTH

  5. #5
    Join Date
    Dec 2004
    Posts
    41
    I've set the combo's control source to the row I wanted eventually, beacuse
    that seems the best way, now I have two issues.

    When I click another value on the combo, it's editing the current row, and not
    moving to the record I selected.

    For example if I have 1, 2, 3, and i'll move from 1 to 3, it will rename 1 to 3
    instead of requering with the data.

    I tried to set the locked option to yes, but then I couldn't click on it at all.

    When I use the mouse scroller, it moves perfectly and refreshes itself between all the rows.

    I'm all lost
    Last edited by SDawn; 01-27-05 at 07:01.

  6. #6
    Join Date
    Dec 2004
    Posts
    41
    No ideas?


  7. #7
    Join Date
    Nov 2003
    Location
    Moorpark, CA
    Posts
    104
    Just a thought. I'm definitely a newbie when it comes to code so I can't really help you there. In the past I've always had an opening form that I work from. If you can't get the combobox to work from the mainform, try creating a form specifically for filters. If you prefer, you can probably make a button on the mainform that links to the filter form. Just put your combobox there and then create a cmdbutton to filter your mainform with whatever selection from your combobox. It's actually quite easy and it may be a quick fix until you can find someone who knows enough code to help do it your way.....

    Hope this helped a little =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •