Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Checkbox converted to Text in Query (2003)

    I have a form with several checkbox's on them , for yes/no responses. I have a situation that I need to define related text for a "checked" checkbox, in a query. For example, if checkbox "A" is "checked" on my form, then in a query I want to take all responses that meet the (-1) criteria for that field, and in another field, have it actually state "Box A". I am trying this in a query but from some reason I am running into a mental roadblock on this one. Here is what I have so far, which isn't much.

    Field: BoxA: If([BoxACheckBox]=-1), Then......... (help)

    Thanks in advance for any assistance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Checkbox converted to Text in Query (2003)

    You can't use If in an expression; you need IIf:

    <code>MyField: IIf([Forms]![NameOfTheForm]![BoxACheckBox],"Box A","")</code>

  3. #3
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Checkbox converted to Text in Query (2003)

    Here is my code that I put into a query field:

    QS9000: IIf([Forms]![frmSupplierMain]![QMS_QS9000:2000],"QS9000","")

    When I run the query I get a "Parameter Value Error".

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Checkbox converted to Text in Query (2003)

    Is the form open when you view the query? If so, are you absolutely sure that the form and control names are spelled correctly?

  5. #5
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Checkbox converted to Text in Query (2003)

    No the form was not open. I did open it, and the query ran perfectly. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •