Forum Discussion

MaxCA1000's avatar
MaxCA1000
Copper Contributor
Jan 15, 2022

Assigning Criteria Result to a Variable

In my query, I have a criteria requiring user input. I want to be able to assign that user input to a public variable and pass it to an iif expression in the same query, and also be able to call the ...
  • arnel_gp's avatar
    Jan 15, 2022

    MaxCA1000 

    you can try creating a Public function for the Parameter Criteria of your query.

    let say your table has a FirstName field and you want to filter it:

     

    global varParam As Variant

    public function getQueryParam()

    gstrParam = ""

    gstrParam = Inputbox("Input the name of person", , varParam)
    If IsNumeric(varParam) Then
    varParam = Val(varParam)
    End If

    getQueryParam = varParam

    end function

     

    your Global/Public variable is varParam.

     

Share

Resources