Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

query function to take multiple text box value as criteria

Discussion in 'Information Technology' started by msmuzila@gmail.com, Jul 28, 2006.

  1. msmuzila@gmail.com

    msmuzila@gmail.com
    Expand Collapse
    Guest

    I have a query that take in the value of one text box through a fuction
    which makes sure the forms is already loaded:

    Here is the query criteria:
    Combo30(33)

    Now i want the criteria to have multiple text boxes

    Here is the function:

    Public Function GetCombo30(ByVal lngID As Long) As Long
    On Error Resume Next
    Dim lngCombo30 As Long

    ' You'll need an IsLoaded or equivilent function
    If CurrentProject.AllForms("Product_Sales_Monthly").IsLoaded Then
    lngCombo30 = Forms!Product_Sales_Monthly!Text42
    Else
    lngCombo30 = lngID
    End If

    GetCombo30 = lngCombo30
    End Function
     
  2. Loading...

    Similar Threads Forum Date
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006
    Sikhism a query Book Reviews & Editorials Aug 2, 2005

  3. Ken Snell \(MVP\)

    Ken Snell \(MVP\)
    Expand Collapse
    Guest

    The function that you show cannot return "multiple criteria" values... it
    can return only one criterion value.

    Are you using this function to get the value in a WHERE statement such as
    this:

    WHERE FieldName = GetCombo30(33)

    It's not clear to me how you're using this function, so I can't really
    suggest how to use this function that you're currently using.

    If you want a function like this to return some type of criterion string,
    then it must return a string value. And the content of the string that it
    needs to return depends entirely on how you're going to use the function in
    a query. The string must be usable in a query's criterion expression; you
    cannot "complete" a query's criterion syntax by this method -- in other
    words, this will not work if you want the query to return the rest of the
    WHERE statement:

    WHERE FieldName = GetCombo30()

    and GetCombo30 returns this string:
    25 OR 36 OR 20

    You'll need to give us more details about the query's SQL statement and how
    you're running the query (is it a stored query? are you building the query
    in code and then running it? do you filter the query through a
    DoCmd.OpenForm (or similar method) call?).
    --

    Ken Snell
    <MS ACCESS MVP>



    <msmuzila@gmail.com> wrote in message
    news:1150563091.632492.100700@u72g2000cwu.googlegroups.com...
    >I have a query that take in the value of one text box through a fuction
    > which makes sure the forms is already loaded:
    >
    > Here is the query criteria:
    > Combo30(33)
    >
    > Now i want the criteria to have multiple text boxes
    >
    > Here is the function:
    >
    > Public Function GetCombo30(ByVal lngID As Long) As Long
    > On Error Resume Next
    > Dim lngCombo30 As Long
    >
    > ' You'll need an IsLoaded or equivilent function
    > If CurrentProject.AllForms("Product_Sales_Monthly").IsLoaded Then
    > lngCombo30 = Forms!Product_Sales_Monthly!Text42
    > Else
    > lngCombo30 = lngID
    > End If
    >
    > GetCombo30 = lngCombo30
    > End Function
    >
     

Share This Page