Results 1 to 8 of 8

Thread: help !!

  1. #1
    Join Date
    Feb 2014
    Posts
    14

    Question Unanswered: help !!

    hello every one
    I have a problem
    created form in this form have tuple name who will pay the money this is list box and second tuple the cost this list box to i wont if select in the first tuple University the second tuple stay visible if select another choice the second tuple invisible how i can do that ??

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I (and probably many others here) have no idea of what you're talking about. Please provide a description of your project and the structure of the tables involved.
    Have a nice day!

  3. #3
    Join Date
    Feb 2014
    Posts
    14
    thank you so much for your time Sinndho
    I have table inside this table ( ID [auto number], Who will spending[list box]{the value inside this list box} [university, employee], the amount[list box]the value inside this list box} [all travel spending, tickets], start date, end date)
    so I create form to all table's inputs but
    the problem: if I chose in tuple [university] from [Who will spending]
    the next tuple[ the amount] it will be visible if I chose employee the next tuple [the amount] it will be invisible ?
    see the picture attached
    Attached Thumbnails Attached Thumbnails 1.JPG   2.JPG  

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You could try something like:
    Code:
    Private Sub SpendingListBox_AfterUpdate()
        If Me.SpendingListBox.Value = "The University" Then
            Me.AmountListBox.Visible = True
        Else
            Me.AmountListBox.Visible = False
        End If
    End Sub
    Replace SpendingListBox and AmountListBox by the actual name of the objects on the form.

    Note: Depending on how the first listbox (spending) is configured, you could have to test for another value than the one contained in the Value property of the control (it depends on the BoundColumn property). You can have access to any column of the current row of a ListBox control using the expression:
    Code:
    Me.ListBox.Column(x)
    where x is the index of the column, knowing that the first (leftmost) column is Column(0).
    Have a nice day!

  5. #5
    Join Date
    Feb 2014
    Posts
    14
    Thank you so much Sinndho
    this so good cod I was use this code I think its same code but the problem in my code and your code its same
    if I chose employee its work correct but wen I wont add another recurred I see the amount its invisible ??
    see this picture please
    Attached Thumbnails Attached Thumbnails 1.JPG   2.JPG   3.JPG   4.JPG  

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I have a problem with the third snapshot: the value if the first combo (SpendingListBox ) is not "The University" so it seems normal that the second combo (AmountListBox) is invisible.

    From the fourth snapshot I infer that you want the second combo adjust according to the contents of the first combo when you move from one record to another. If I'm correct, here's how to do it:

    1. Create a procedure in the module of the form, like this:
    Code:
    Private Sub AdjustCombo()
        If Me.SpendingListBox.Value = "The University" Then
            Me.AmountListBox.Visible = True
        Else
            Me.AmountListBox.Visible = False
        End If
    End Sub
    2. Create an event handler for the Form_Current event (or add the line to the existing one):
    Code:
    Private Sub Form_Current()
        AdjustCombo
    End sub
    3. Replace the AfterUpdate event handler of the fist combo, like this:
    Code:
    Private Sub SpendingListBox_AfterUpdate()
        AdjustCombo
    End Sub
    That way, the visibility of the second combo will be adjusted each time the current record changes (Form_Current event handler), as well as each time the selection in the first combo is changed (Combo_AfterUpdate event handler).
    Have a nice day!

  7. #7
    Join Date
    Feb 2014
    Posts
    14
    yes its correct exactly this what I need you so smart
    than you so much

  8. #8
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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