Get Form Data into Parameter Query ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • B1ackwater

    #1

    Get Form Data into Parameter Query ?


    Is there a straightforward way to to take values on a form and
    use them as parameters in a SQL query ? The VBA function
    OpenQuery doesn't seem to provide for passing parameters and
    the macro builders similar function doesn't either.

    Sometimes you'd like to be able to use the validation functions
    forms offer or run a query that uses a calculated result that
    you're displaying on a form.

    [access 2007 beta]

  • pietlinden@hotmail.com

    #2
    Re: Get Form Data into Parameter Query ?


    B1ackwater wrote:[color=blue]
    > Is there a straightforward way to to take values on a form and
    > use them as parameters in a SQL query ? The VBA function
    > OpenQuery doesn't seem to provide for passing parameters and
    > the macro builders similar function doesn't either.
    >
    > Sometimes you'd like to be able to use the validation functions
    > forms offer or run a query that uses a calculated result that
    > you're displaying on a form.
    >
    > [access 2007 beta][/color]

    Something along the lines of

    SELECT....
    FROM...
    WHERE SomeField=Forms ![My_OPEN_Form]![ControlNameOnFo rm]

    The problem with this is that you can't do optional params...

    You can, however, do something like

    SELECT....
    FROM...
    WHERE SomeField LIKE "*" & Forms![My_OPEN_Form]![ControlNameOnFo rm] &"*"

    Comment

    Working...