Results 1 to 12 of 12
  1. #1
    Join Date
    Sep 2006
    Posts
    26

    Unanswered: finding a control for selecting rows from a dataset

    I want to set up a form where the user retrieves several rows, then selects one or more of the result set and process those rows further. I tried setting up a form with a Datasheet subform, and I can query the data, but I can't select noncontiguous rows. I can hold the shift key down and select a contiguous block of rows, but then I don't see how you would do something like select the 1st, 3rd, and 5th row. Ideally, I would like to find a control that allows you to imbed a checkbox field in each row so the user can easily select whatever rows they want. I have started browsing through the list of controls but no luck yet. Thanks.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    would like to find a control that allows you to imbed a checkbox field in each row so the user can easily select whatever rows they want.
    You're sooooo close to solving this yourself!!

    Simply add a field to the table called "Selected" that is Yes/No. Then just use a checkbox
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Sep 2006
    Posts
    26
    I don't have a table that I can add a field to -- I am querying from an external source. I added a field called "Selected" to my query, and also added it to the subform design as a checkbox. Now it does show up on my form, but when I click one checkbox, they all fill with checks.

  4. #4
    Join Date
    Sep 2006
    Posts
    26
    It does work if I create a separate table with my data. I suppose I could load each query into a table and then process it from there. This seems like unnecessary trouble to go through though. Thanks for your help.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're welcome

    You could also make a small table (holding the ID of the records) that when you check your select checkbox, add the ID of that record to the new table... just another variation on a theme though, nothing will works as well as a field in the table.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by StarTrekker
    You're welcome

    You could also make a small table (holding the ID of the records) that when you check your select checkbox, add the ID of that record to the new table... just another variation on a theme though, nothing will works as well as a field in the table.
    That would be my vote. The user doesn't need to know they're looking at a dataset that has had a checkbox artificially attached and they don't need to know that when you check that box it's actually adding a row to a local dataset containing the PK information required to build the "final" set.

    Also, this solution allows multiple users to work with this functionality at the same time whereas with putting a bit on the source table itself, only one person can define a sample dataset at any given time since everyone is partying directly on the same table.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Only disadvantage is that the select checkbox won't act as it should on a continuous form ... ie when you move from record to record, ALL the ticks will go on and off since it's not bound.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  8. #8
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You can still bind it to a query.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  9. #9
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You can? Wouldn't that result in the inability to change its state?

    Cool... something new to think about
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  10. #10
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Not if primary key information is present...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  11. #11
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Excellent, thanks

    I chucked something together to see it happen, as expected, it works great!

    For some dumb reason, I have never thought to do that; I've always managed to get away with adding the bit to the table.

    Thanks again
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  12. #12
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    What is the simplest way to get this to work on a continuous subform?

    I've created the simplest database to test this all out and it works great in the query and on the subform object when not in the main form, but when I try to look at the subform when in the mainform, the data in the subform is locked.

    DB attached.

    TIA
    Attached Files Attached Files
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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