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
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using tick boxes in an asp form/database

    hello.

    if i have an asp form to update a database through ms access how would i go about implementing the use of tick boxes in it? i.e do i have to select 'Tick box' from the type when making the database? how wold the data be displayed etc..? sorry bit vague i know!

    thanks in advance!
    Web and Business Development from Cornwall - Startbar.co.uk

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You mean checkboxes? In Access they are called Yes/No fields when you design the table and believe they return true or false when queried and you can use true/false to set the value using SQL. It just a boolean field basically they just don't call it that in access, lol.
    OracleGuy

  • #3
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Or if you mean radio boxes, it would be the same as what oracleguy said.

    If you wish to know how to put the checkboxs results from a database back into checkboxes on a form this recent reply will help you
    ASP & form check boxes

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    ya but i'm not selecting from multiple columns,
    i'm selecting from one column, with values sparated by comas,

    if thats the way this code works, then i don't understand it,

    Code:
    Dim SQL, oRS, I, strOption(8)
    
    SQL = "SELECT fldOption1, fldOption2, fldOption3, fldOption4, fldOption5, fldOption6, fldOption7, fldOption8 FROM tblForm WHERE ID = " & SelectedID
    Set oRS = oConn.Execute(sSQL)
    
    For I = 1 To 8
      If oRS("fldOption" & I) = True Then
        strOption(I) = " checked"
      Else
        strOption(I) = ""
      End If
    Next
    %>
    
    <input name="option1" type="checkbox"<%=strOption(1)%>>
    <input name="option2" type="checkbox"<%=strOption(2)%>>
    <input name="option3" type="checkbox"<%=strOption(3)%>>
    <input name="option4" type="checkbox"<%=strOption(4)%>>
    etc...

  • #5
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Quote Originally Posted by angst
    ya but i'm not selecting from multiple columns,
    i'm selecting from one column, with values sparated by comas,

    if thats the way this code works, then i don't understand it,

    Code:
    Dim SQL, oRS, I, strOption(8)
    
    SQL = "SELECT fldOption1, fldOption2, fldOption3, fldOption4, fldOption5, fldOption6, fldOption7, fldOption8 FROM tblForm WHERE ID = " & SelectedID
    Set oRS = oConn.Execute(sSQL)
    
    For I = 1 To 8
      If oRS("fldOption" & I) = True Then
        strOption(I) = " checked"
      Else
        strOption(I) = ""
      End If
    Next
    %>
    
    <input name="option1" type="checkbox"<%=strOption(1)%>>
    <input name="option2" type="checkbox"<%=strOption(2)%>>
    <input name="option3" type="checkbox"<%=strOption(3)%>>
    <input name="option4" type="checkbox"<%=strOption(4)%>>
    etc...
    Looks like you posted in the wrong theard. I replyed in the real thread.


  •  

    Posting Permissions

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