Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Listbox (Access97)

    Hi, in VB6 it is possible to insert a listbox into a form and set it's style to 1 - checkbox, is this control available in Access ? If so where do i set the style to 1 - checkbox ?
    I would like to use this control to allow users to select which reports they would like to run.

    many thanks for any thoughts or comments you may have

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Listbox (Access97)

    Hi,
    You could use the Microsoft Forms Listbox control in a form - you can set its ListStyle property to Option rather than Plain. Not sure it's worth the effort personally though, just to add a check mark! It's usually pretty obvious what's selected in a list box..... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Listbox (Access97)

    Just use a multiselect listbox if you're trying for multiple selections. The VB controls have cute features but they don't make up for the fact that there is no built-in ItemsSelected collection for those controls.
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listbox (Access97)

    Not sure what you mean by 'just add a check mark' ? is this a new control for each row selected ?
    this particular database is part of the accounts time recording system and has maybe 30 reports that need to be run for each department (8 departments) som each month, others each quarter.
    I want to provide a 'Control Panel' that will allow the user to select the required reports, the required departments and press 'Go' to launch these to the printer.
    I think that a multicolumn list box with a checkmark against selected rows is the answer that is best (? still open to persuasion !)

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Listbox (Access97)

    All I meant was that it was a lot of effort just to have a check mark next to the selected items. If you use a multi-select listbox, all the selected items are highlighted, so I don't think there's any real need for a check mark next to them. You also only need a single column listbox. As Charlotte said, Access native controls have various properties that make them easier to work with. <img src=/S/smile.gif border=0 alt=smile width=15 height=15> The built-in listbox is also easier to populate!
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listbox (Access97)

    OK you have both <img src=/S/bash.gif border=0 alt=bash width=35 height=39>convinced <img src=/S/bash.gif border=0 alt=bash width=35 height=39> me not to have any bells on this form. I would like however to have a whistle !?

    I am getting the list of reports from the msysobjects table, where is the description for each report held ? I was rather hoping to be able to display an english explanation of the reports too ?

    After the user has finished selecting the reports i would like to reformat the list box to only show the selected items, where is the VBA equivalent of .AddItem ?

    ps, i'd still like a Cornish flag on the smilies please !!!

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Listbox (Access97)

    There is no .AddItem for listboxes in Access. Sorry about that.

    You can change the rowsource of the listbox, but you're going to have problems if you try to change between a table/query type rowsource and a values list type rowsource on the fly. A Values List rowsource is a semicolon delimited string, so you could create or modify it on the fly easily enough, although it's much easier in Access 2000.

    The description is a property of the report. In Access 97, you need to use DAO to return something like:

    CurrentDb.Containers("Reports").Documents(strReptN ame).Properties("Description")

    If you use a multiselect, all the selected items will be highlighted. Why don't you just create a function to return both the name of the report *and* the description in the first place and hide the report name.
    Charlotte

Posting Permissions

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