Query No-Brainer

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

    Query No-Brainer

    I must be having a bad day because this is so elementary. I have a
    calculated field in a query:

    Criteria: IIf([forms]![frmMain]![cboDiscipline]="All","All" ,[TASK_COMPLETE])

    If I run the query without the form and enter the parameters manually it
    works. If I run it with the form open then the field returns
    [TASK_COMPLETE] regardless of the selection made using cboDiscipline.

    cboDiscipline has a value list of All;Y as its row source.

    I'm getting ready to slap my forehead ... what am I doing wrong?

    Thanks.
    Keith.

  • KC-Mass

    #2
    Re: Query No-Brainer

    Why don't you make a selection in the combobox
    open a module and in the immediate window try
    "? [forms]![frmMain]![cboDiscipline]" without the quotes
    and then
    "? [forms]![frmMain]![cboDiscipline] = "All" " with quotes only on the All

    and see what the system thinks the expression evaluates to?
    My guess would be that you have a different column bound to the cbo.


    "Keith Wilby" <here@there.com wrote in message
    news:48295fd2$1 _1@glkas0286.gr eenlnk.net...
    >I must be having a bad day because this is so elementary. I have a
    >calculated field in a query:
    >
    Criteria:
    IIf([forms]![frmMain]![cboDiscipline]="All","All" ,[TASK_COMPLETE])
    >
    If I run the query without the form and enter the parameters manually it
    works. If I run it with the form open then the field returns
    [TASK_COMPLETE] regardless of the selection made using cboDiscipline.
    >
    cboDiscipline has a value list of All;Y as its row source.
    >
    I'm getting ready to slap my forehead ... what am I doing wrong?
    >
    Thanks.
    Keith.

    Comment

    • Keith Wilby

      #3
      Re: Query No-Brainer

      "KC-Mass" <connearneyATco mcastDOTnetwrot e in message
      news:CYmdnWVKxc 1cGrTVnZ2dnUVZ_ hSdnZ2d@comcast .com...
      Why don't you make a selection in the combobox
      open a module and in the immediate window try
      "? [forms]![frmMain]![cboDiscipline]" without the quotes
      and then
      "? [forms]![frmMain]![cboDiscipline] = "All" " with quotes only on the All
      >
      and see what the system thinks the expression evaluates to?
      My guess would be that you have a different column bound to the cbo.
      >
      I realised my mistake about 5 seconds after pressing "send" and I
      immediately cancelled my posting but it seems that I wasn't fast enough. I
      had copied/pasted the calculated field from another query and forgotten to
      change the cboName it was referring to (cbo's are unbound). Sorry to have
      been any trouble and thanks for responding.

      Regards,
      Keith.

      Comment

      Working...