Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - checkboxes with Access
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

checkboxes with Access

 Post Reply Post Reply
Author
vicky_c View Drop Down
Newbie
Newbie


Joined: 14 March 2003
Location: Scotland
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote vicky_c Quote  Post ReplyReply Direct Link To This Post Topic: checkboxes with Access
    Posted: 31 March 2003 at 6:33am

Hi!  Sorry to bother you guys again but my project is almost done and I have come across a small problem...

Users fill out a form, the contents of which are verified and then written to an Access Database.  One of the objects is a checkbox.  It is asking the user wether or not they wish to receive a newsletter.  In the database, the column for 'newsletter' is in the data type 'yes/no' but I don't know how to write wether it was checked or not into the database.  Can Anyone help?

This is what i have so far for the text fields....

rs("username")=username
rs("password1")=password1
rs("fullname")=fullname
rs("email")=email
rs("location")=location
rs("birthday")=birthday
rs("birthmonth")=birthmonth

I tried rs("newsletter")=newsletter for the checkbox but I got a data mismatch error. 

I'd be really grateful for any help you could give me!  I appreciate what you guys do for us amateurs!

Loadsa love,
Vicky  xxx

 

Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2003 at 8:03am

try IF newsletter = "yes" THEN

newsletter = True

Else

newsletter= False

END IF

rs("newsletter")=newsletter

 



Edited by ultramods
Back to Top
vicky_c View Drop Down
Newbie
Newbie


Joined: 14 March 2003
Location: Scotland
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote vicky_c Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2003 at 1:30pm

Thanks!!  It's almost working now!  I don't get any errors anymore but when i open the database, boxes that should be checked aren't.

Any idea wots going wrong?

Thanks again!!

Loadsa love,
Vicky  xxx

Back to Top
vdub View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 February 2003
Location: United States
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote vdub Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2003 at 1:46pm

I recoment not using the checkboxes in the database.

for a check box I just do this

<%
IF checkbox = "true" Then
SQL = "UPDATE config SET newsleter = 't' WHERE DBID ="& User
    Set RS = DBConnection.Execute(SQL)

ElseIF checkbox = "false" Then
SQL = "UPDATE config SET newsleter = 'f' WHERE DBID ="& User
    Set RS = DBConnection.Execute(SQL)

Else

End IF
%>

Then to to pull the data back out of the database just do this.

<%
SQL = "Select * From newsleter Where DBID ="& user 
      Set RS = DBConnection.Execute(SQL)

      newsleter=RS("newsleter")
%>

Yes<INPUT TYPE="radio"  NAME="news" VALUE="true" <%IF newsleter= "t" Then%>CHECKED<%Else%><%End IF%>>
No<INPUT TYPE="radio" NAME="news" VALUE="false" <%IF newsleter= "f" Then%>CHECKED<%Else%><%End IF%>>


Hope that helps



Edited by vdub
Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2003 at 2:32pm
To fix the problem with the database you can change yes/no format from yes/no to true/false. (under the general tab whilst in design view)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.