Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    30

    Unanswered: Help! passing true value from form to query

    This I would have thought would be an easy question to answer, but microshit strikes again. I have a form, which an unbound combo box gets its values from a union query. I set an additional value in the union query to <ALL> and then I give an event based on the selection in the combo box. My understanding of access is if you open a query and type True as the criteria for any field it will give you all the records where there is a value in that field. I have tested this directly in the query and it works. However, I try passing this value from my form to the query and it always fails. Here is my simple code:

    Code:
    Private Sub Combo6_AfterUpdate()
    If Combo6 = "<ALL>" Then
            Combo6.Value = True
            Else
            Combo6.Value = Combo6
            End If
    End Sub
    The above code works correctly in passing a null value in a sample database which I am referencing from a book to help me. Why is it not passing a True value to my query????????

  2. #2
    Join Date
    Jan 2004
    Location
    Islamabad, Pakistan
    Posts
    97
    Private Sub Combo6_AfterUpdate()
    If Combo6 = "<ALL>" Then
    Combo6.Value = True
    Else
    Combo6.Value = Combo6
    End If
    End Sub

    From the above code it is obvious that you've initialized the Combo6 as text and not as a boolean where as True is a boolean value and not a text value.

    Another simple approach!...

    Try use a check box (which would be a boolean field) with it's label as Show ALL on the same form and use it's value as critera for the query.

  3. #3
    Join Date
    Jun 2004
    Posts
    30
    Actually the bound column in the combo box is a number, which I have considered, but if I assign a number to the <ALL> value, such as -1, I dont know how to do the other side to make the -1 value represent True. I will post a sample to help anyone to help me.
    Attached Files Attached Files

  4. #4
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Unhappy

    bonito,

    I d/l your database but don't see a ComboBox labeled as "Combo6"? Which form is that on? Next, exactly what are you wanting to happen with the ComboBox, rather After you select your choice in the ComboBox???

    trying to help,
    Bud

Posting Permissions

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