A little help on an operator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • troy_lee@comcast.net

    A little help on an operator

    I am passing a value from a combo box on a report initiation form to a
    query which is the record source for the report.

    My question is how do I pass the combo box value with an operator. I
    want to pass this: <>59.

    The query will run if I use 59, but will not run with <>59. Ideally, I
    want to use the Like statement before the form's control reference in
    the query criteria field so I can also run a "*" for all records. I
    have tried everything I can think of but no success with the operator
    and number criteria.

    Thanks in advance.

    Troy Lee
  • fredg

    #2
    Re: A little help on an operator

    On Tue, 10 Jun 2008 11:24:53 -0700 (PDT), troy_lee@comcas t.net wrote:
    I am passing a value from a combo box on a report initiation form to a
    query which is the record source for the report.
    >
    My question is how do I pass the combo box value with an operator. I
    want to pass this: <>59.
    >
    The query will run if I use 59, but will not run with <>59. Ideally, I
    want to use the Like statement before the form's control reference in
    the query criteria field so I can also run a "*" for all records. I
    have tried everything I can think of but no success with the operator
    and number criteria.
    >
    Thanks in advance.
    >
    Troy Lee
    You cannot pass the <operator, but you can include it in the query
    criteria.

    WHERE YourTable.Field Name <>[Forms!FormName! ControlName] OR
    [Forms!FormName! ControlName] Is Null

    If you do not enter anything in the form control all records will be
    returned.
    If you enter a number value in the control, just those records will
    NOT be returned.

    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail

    Comment

    • Salad

      #3
      Re: A little help on an operator

      troy_lee@comcas t.net wrote:
      I am passing a value from a combo box on a report initiation form to a
      query which is the record source for the report.
      >
      My question is how do I pass the combo box value with an operator. I
      want to pass this: <>59.
      >
      The query will run if I use 59, but will not run with <>59. Ideally, I
      want to use the Like statement before the form's control reference in
      the query criteria field so I can also run a "*" for all records. I
      have tried everything I can think of but no success with the operator
      and number criteria.
      >
      Thanks in advance.
      >
      Troy Lee
      You might create a report with a recordsource like
      Select * From Table1

      There's no filter, just all the records.

      Now when you open the report, you might set the filter
      Me.Filter = "Status <59"
      Me.FilterOn = True

      If you are using a current version of Access, you can pass the argument
      to the report. Docmd.OpenRepor t "x",,,,,"<5 9"
      If Not IsNull(Me.OpenA rgs) then
      Me.Filter = "status " & Me.OpenArg
      Me.FilterON = true
      Endif

      Denial

      Comment

      Working...