Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select Columns Command (Access 2003)

    I have a subform (datasheet) and would like to select a group of columns by clicking a button on the parent form. I've looked for a command that allows me to select a column (or group of), but can't seem to find anything. Does anyone know what command or commands I could use?

    Thanks in advance for any help.
    Drew

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Columns Command (Access 2003)

    Can you tell us what you want to accomplish by selecting columns?

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Columns Command (Access 2003)

    The subdatasheet is an intermediate table for data that I get from our PDM system, which is pasted from my clipboard after coping from a system report. After it's pasted, I select the import button and the data cascades into multiple tables. For now, I don't need to insert data into some of the tables, so I only select 12 of the 35 columns (script does the rest). It would be nice to have a convenient button to select the columns I'm interested in.

    Thanks,
    Drew

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Columns Command (Access 2003)

    I don't know of any way to use code for selecting columns in a datasheet, but if you already know which columns you need, there should be other ways to fill only the tables you want. Without knowing any details, it is impossible to provide more specific suggestions.

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Select Columns Command (Access 2003)

    If you really need to select columns in a datasheet form (or subform), you can use the Form SelTop, SelLeft, SelHeight, & SelWidth properties for this purpose. The attached database (A2K format) demonstrates how to use these properties to get or set the selected columns (or rows) in a datasheet form. Open one of the sample forms & use the custom toolbar (or custom right-click popup menu) to get or set selected columns. See code module for details. Note that the SetSelection function automatically includes all rows by using the form's record count (plus one - apparently the column headers count) for SelHeight property. This can be modified as needed. The code also determines if active form is a form or subform, and uses CurrentView property to ensure form is in datasheet view (or error may occur).

    Note: I'm unaware of any way to select non-contiguous columns either "manually" or using VBA. You can select only adjacent columns. Of courses datasheet columns can be rearranged if that is an issue.

    Personally I've never had a need to do this in code, when exporting a datasheet I usually export the entire recordset that populates the form or subform.

    HTH

Posting Permissions

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