Results 1 to 9 of 9
  1. #1
    zxis
    Guest

    ListBox on Subform

    Access 97, Jet 3.51, MDAC 2.6

    I have a many to many relationship that is resolved to a third table (child). Single PK for each of the Master Tables.

    I have a form with a subform showing this information. The child's fields are hidden.

    I use a query to fill the subform with one master table's records, and the child's fields (hidden). It doesn't matter which table since it should work either way, depending on how you want to present the data.

    On the main form my Record source is the other master table and the subform link field is the PK of the controlling master table to child table.

    My problem is that the listboxes loose their behavior when displayed as a subform on the master form. The lookup is defined at the table level and I even set them in the subform. All of the listboxes in the subform appear as normal fields. What am I missing?

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

    Re: ListBox on Subform

    First off, don't define lookups at the table level. I know it seems handy to have the wizard automagically create a combobox when you drag the field onto the form, but it also creates a drag on performance, since you have built the equivalent of a query into your table and you're doing it again on the form. The rule is that users don't see tables anyhow, so there isn't any need for the lookup there. It's just a shortcut for lazy programmers.[img]/w3timages/icons/grin.gif[/img]

    I don't understand this statement
    <hr>My problem is that the listboxes loose their behavior when displayed as a subform on the master form .... All of the listboxes in the subform appear as normal fields<hr>
    Do you mean that you don't see any values or what? And are these listboxes or comboboxes?
    Charlotte

  3. #3
    zxis
    Guest

    Re: ListBox on Subform

    Hey, I resent being called a lazy programmer. :-) [img]/w3timages/icons/nuts.gif[/img]

    So when does or under what conditions does Access trigger the table level lookup? I would have thought that this occurred only during record update/change or new record. We can start another thread on this topic if you prefer.

    When the subform is displayed on the form, all listboxes on the subform no longer give one a dropdown list. They are blank. They look like a text field when you enter the field. They are list boxes.

  4. #4
    Lounger
    Join Date
    Feb 2001
    Location
    TX, USA
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ListBox on Subform

    there is no such thing as a dropdown in a listbox. You are describing a combobox

  5. #5
    zxis
    Guest

    Re: ListBox on Subform

    Well, I assume it is a listbox, since I defined it in the table that way and also defined it on the form that way. In testing the first reply, I dropped the table definition and used a wizard [img]/w3timages/icons/hairy.gif[/img] to define a listbox. It appears to drop down when I select the button. Enclosed is a snapshot of the result of this exercise. I also threw on a combobox so you wouldn't think I am too crazy.

    Interestingly, the listbox works on when manually defined in the subform and the combobox for that matter. Why they both have the same appearance, I know not.

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

    Re: ListBox on Subform

    It probably is a listbox. However, in a continuous subform, it will look the same as a combobox, because it only has one line high to display its contents, same as the combobox. The question is why you defined it as a listbox in the first place. A combobox will work on a continuous form, but a listbox is pretty useless there. Listboxes do NOT drop down, although they may scroll, and what you're seeing is probably the down arrow on the compressed scrollbar.
    Charlotte

  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 on Subform

    It has to populate the list or combobox when you access the field, otherwise, you couldn't use it to do updates and changes.
    Charlotte

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

    Re: ListBox on Subform

    They aren't really dropping down in the same sense that a combobox does. What appears to be happening is that the whole list box becomes visible when it receives the focus, giving it the effect of a dropdown. I suspect that the rest of the behavior (ie., the down arrowhead) is because listboxes were never really intended for use in datasheet view, so Access is doing the best it can to present information in an awkward format.
    Charlotte

  9. #9
    zxis
    Guest

    Re: ListBox on Subform

    I do use a select statement to populate the controls where needed. Salutation and suffix are fairly static, so I define them at the table. As to the value of where & when to use a listbox, depends on objective. No need to let the user manually enter data in these instances, so a listbox works quite fine. They only differ in that a listbox does not allow a typed entry, where a combo box does. In response to the no drop down insistence, I used the wizard to create a simple form of the data with the "person type" as a listbox. I then added "person type" as a listbox using the listbox control. I present 3 views, two as a datasheet (one with the rows expanded) and one as a continuous form. As can be seen, there is no spinner or scroll bar in the datasheet view, it is a down arrow. As the second field shows, the appearance is that of a dropdown when the field is selected. This pictoral evidence seems to fly in the face that a listbox does not drop down. I am not trying to be a smartaleck, just trying to understand. I still do not understand why the orginal form would display all of the listboxes as regular fields, when they worked as listboxes when viewed independently in the subform.

    Ed: Hi, your screenshot was gigantic and distorting the layout of the board so I've cut it down. Could you *all* please remember to conserve bandwidth by clipping and shrinking your graphics to the minimum before you upload them to the forum. --Eileen

Posting Permissions

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