Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2002
    Location
    NW Iowa
    Posts
    185
    Thanks
    9
    Thanked 0 Times in 0 Posts

    MS Access - if yes/no field is checked, then display x, else display n

    How, using ASP, can I say:

    If field is checked, then response.write("Checked") Else response.write("Not Checked")

    I've searched the forums here, and tried using Google, but to no avail, so now I'm asking for help.

    Thanks in advance,
    Matt

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    When do you want it to occur?
    On the server-side, after form submit, just check for the value of your checkbox like any other form field. If you want to know on the client side, before form submit, you have to use javascript.
    See here for a little forms tutorial.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Dec 2002
    Location
    NW Iowa
    Posts
    185
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I have a recordset that is retrieving information for me that I am displaying on a page. The information is already sitting in a database.

    Specifically, what I am doing, is I have a Yes/No field in Access, that notes whether or not registration is available for an event. In my recordset, where I am showing the different events, I want to show a register button if the field 'f_register' is checked, otherwise I want to hide it. I could do this with a text type field, using "Yes" and "No", but I'd rather use a checkbox type field in Access.

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    [edited]
    Okay, see if this link helps you.
    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=141
    Last edited by nikkiH; 06-16-2005 at 10:42 PM.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    Regular Coder Freon22's Avatar
    Join Date
    May 2005
    Location
    USA
    Posts
    287
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by mattboy_slim
    I want to show a register button if the field 'f_register' is checked, otherwise I want to hide it. I could do this with a text type field, using "Yes" and "No", but I'd rather use a checkbox type field in Access.
    It would be easer if you would show your code. But I think I would do something like.

    If objRS(“f_register”) = True Then
    Response.Write(“Checked”)
    Else
    Response.Write(“Not Checked”)
    End If

    If you are using some type of button, that you only want to show if f_register is checked. You could

    If objRS(“f_register”) = True Then
    ‘Show Button
    End If

    So as you can see there are a lot of way to do this.


  •  

    Posting Permissions

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