Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2013
    Posts
    9

    Unanswered: Saving combo box selections after a form is closed

    Hi all,

    I have exhausted my efforts to no avail. I would really appreciate your guys help on this one!

    I have a main form called frmAF54. In this main form I have a subform named frmPassdown. The subform record source is from a table called tblCards. This table contains many different cards. I have a combobox called lstOpCard in the main form as well. The combobox lists all of the different cards in "tblCards". I have a button called "buttonFilter".

    A user opens the form and clicks (or selects) the different cards in the combo box "lstOpCard" that they want to filter for. Once their selections are made, they can click the "buttonFilter" button and the subform "frmPassdown" will be filtered based off of their selections.

    The filter is applied using the IN() function as shown below:
    Me.AF54PassDown.Form.Filter = "[OpCardID] IN ( " & sTemp & " )" --sTemp is a string containing the keyIDs of the cards selected.

    My problem is that people will be opening and closing the form throughout the day / week. When the form closes, it loses the applied filter. How can I have my filter on the subform be saved after the form is closed and the filter is still applied when the form is opened later?

    Your help is very much appreciated!! If you need any additional information, please let me know. Providing code will be a huge help to me as well as I am new to access.

    Thank you,

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    What's wrong with the solution I provided ? http://www.dbforums.com/microsoft-ac...ml#post6602687
    Have a nice day!

  3. #3
    Join Date
    Sep 2013
    Posts
    9
    Your solution works for moving the first combobox's selections over to the second combobox - and thank you for that!!

    However, when the second combox is populated with my selections and I close and re-open the form, the second combobox re-opens as blank and the first combobox's selections are de-selected.

    I need to solve the problem of saving the selections or the filter when the form is closed or re-opened. I would appreciate any help on solving this issue! If you have a different strategy for sovling this issue, I'm all ears. I've been mulling over this for a couple weeks now with no solution.

    Thank you,

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    How about:
    Code:
    Private Sub Form_Close()
        SaveRowSource CurrentProject.Path
    End Sub
    
    Private Sub Form_Open(Cancel As Integer)
        LoadRowSource CurrentProject.Path
    End Sub
    Have a nice day!

Posting Permissions

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