Results 1 to 7 of 7

Thread: Form problem

  1. #1
    Join Date
    Oct 2003
    Posts
    61

    Unanswered: Form problem

    I have an issue with a form I really do not understand.

    The form has 1 combobox and 3 listboxes
    The rowsource of the 3 listboxes is empty when I open the form. When I update the combobox the Rowsources of the listboxes is being filled with three different queries and the listboxes are requeried after that. The 3 queries are all depending on a parameter which is in the combobox so there should be no problem.

    The strange thing is that when i put the first two listboxes in the form everything went ok. The problem came in when i put in the third list box in the form. All of a sudden when i now open the form it starts asking for the parameter which is of course not filled yet since i haven't even been able to touch the combobox to select a value which can be used as a parameter.

    When i remove the third listbox the problem is gone.

    Does anybody kmow how i can prevent this from happening or why this happens in the first place? I really do not understand this at all.
    Nobody dies a virgin because life screws us all!

  2. #2
    Join Date
    Oct 2003
    Posts
    61
    anyone please?
    Nobody dies a virgin because life screws us all!

  3. #3
    Join Date
    Dec 2004
    Posts
    277
    are you running the list boxes off of queries based off of criteria set from a previous listbox??

  4. #4
    Join Date
    Oct 2003
    Posts
    61
    The rowource of the listboxes is based on queries which have a parameter (the combobox!)
    Nobody dies a virgin because life screws us all!

  5. #5
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    In the third listbox, don't set the rowsource until after the combo box's after_update event fires. Then requery the listbox and it should work.

    Canupus

  6. #6
    Join Date
    Oct 2003
    Posts
    61
    Quote Originally Posted by canupus
    In the third listbox, don't set the rowsource until after the combo box's after_update event fires. Then requery the listbox and it should work.

    Canupus
    I already did this : the rowsource of the listbox is set in the after update event of the the combo box but still the problem occurs
    Nobody dies a virgin because life screws us all!

  7. #7
    Join Date
    Oct 2003
    Posts
    14

    Lightbulb

    Hey,
    your first two listboxes are working fine, and the problem is in the third one. Here's how I would go about it..

    Using VBA..

    TblZero
    ---------
    rowid
    valueincbo
    [...fields]

    TblOne
    ---------
    rowid '= to valueincbo
    field1
    field2
    field3

    FORM: TblZero
    -------
    cboCombo1 (properties)
    ~Set its [control source] to "valueincbo"

    listbox1 (properties)
    ~Row Source Type = Table/Query
    ~Row Source = SELECT field1 FROM TblOne WHERE rowid = [TblZero].cboCombo1

    listbox2 (properties)
    ~Row Source Type = Table/Query
    ~Row Source = SELECT field2 FROM TblOne WHERE rowid = [TblZero].cboCombo1

    listbox3 (properties)
    ~Row Source Type = Table/Query
    ~Row Source = SELECT field3 FROM TblOne WHERE rowid = [TblZero].cboCombo1


    ...THEN in VBA
    ------------------

    Private Sub cboCombo1_change()
    listbox1.requery
    listbox2.requery
    listbox3.requery
    End Sub


    This should work for the situation...
    Hope it helps,

    John

Posting Permissions

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