Results 1 to 9 of 9
  1. #1
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo/list box problems (2003 SP2)

    I've got a form for data entry with some cascading combo boxes & a pair of list boxes. The list boxes are cascaded from the combo boxes & are only there to show a single value. This is then to be stored in the record.

    However neither store the values, the values are displayed though.

    I did want to use text boxes but couldn't get them to work with a query.

    Help please. TIA

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

    Re: Combo/list box problems (2003 SP2)

    If the list boxes are intended to display a single value only, bound text boxes would be better. You can use the After Update event of the combo boxes to set the value of the text boxes.

    If you prefer to keep the list boxes, you should use the After Update event of the combo boxes to set the value of the list boxes besides setting their row source and/or requerying them. And make sure that the list boxes are bound.

  3. #3
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo/list box problems (2003 SP2)

    The list boxes are displaying the the appropriate values (have used the After Update for this). But though they are bound to the relevant fields, thes values are not being stored.

    I would prefer text boxes, but I can't figure out why the sub-queries used for the list boxes won't work with a text box.

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

    Re: Combo/list box problems (2003 SP2)

    A list box can have a query or SQL string as Row Source, but a text box doesn't have a row source.

    Can you post the After Update event procedure for one of the combo boxes that "controls" a list box?

  5. #5
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo/list box problems (2003 SP2)

    Here's the line (required field, therefore not set to null first), it's for both list boxes;

    Private Sub Combo52_AfterUpdate()
    Me!Text55.Requery
    Me!TempLst.Requery

    End Sub

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

    Re: Combo/list box problems (2003 SP2)

    Try this:

    Private Sub Combo52_AfterUpdate()
    Me!Text55.Requery
    Me!Text55 = Me!Text55.ItemData(0)
    Me!TempLst.Requery
    Me!TempLst = Me!TempLst.ItemData(0)
    End Sub

  7. #7
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo/list box problems (2003 SP2)

    Aha, that's doen the trick. Thank you.

    BTW how does the ItemData change the way the values are stored?

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

    Re: Combo/list box problems (2003 SP2)

    Requerying a list box only updates the list, it doesn't set the value. The lines I added set the value of the list box to the first item in the list (which in this situation is also the only item). The value is what gets stored.

    ItemData(0) is the first item since counting starts at 0.

  9. #9
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo/list box problems (2003 SP2)

    OK, I understand.

    Again, thank you.

Posting Permissions

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