Results 1 to 3 of 3

Thread: CHECKBOXES !!!!!!!!

  1. #1
    Join Date
    Dec 1969

    Default CHECKBOXES !!!!!!!!

    I am using an insert query to add information from a form to a microsoft Access 97 database. The form is populated with multiple textboxes and checkboxes. <BR><BR>I can insert infromation from the textboxes, but I get an "[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression." error message whenever I try to insert the checkbox information. <BR><BR>The field properties for the checkboxes in the access database are set "ON" and "OFF". When I check to see what is in the value for a checked box on the form it is indeed "ON". Has anybody run across this problem?<BR><BR>I am also using an if statement to check the contents of the checkbox:<BR> if Request.Form("EmpAdmin") = "ON" then<BR> strAdmin = (Request.Form("EmpAdmin"))<BR> End if<BR><BR>HELP!!!!!!<BR>

  2. #2 Guest

    Default RE: CHECKBOXES !!!!!!!!

    Hi KJ,<BR> In access the on/off field takes only one bit.So u can insert the field as 1 or 0 only into the database depending upon the status of checkbox.So u need to try like this...<BR> if Request.form("EmpAdmin")="ON" then<BR> update &#060;table&#062; set &#060;fieldname&#062;=&#039 1&#039<BR> else<BR> update &#060;table&#062; set &#060;fieldname&#062;=&#0390&#039<BR> end if<BR>So i hope this works.I appreciate if u can mail me back with info. wheather it is working or not.<BR><BR>Balaji

  3. #3
    Richard L. Guest

    Default RE: CHECKBOXES !!!!!!!!

    I had *exactly* this problem just a few days ago:<BR><BR>For a yes/no (boolean) field in MS Access 97, values are 0 = false/no -1 = true/yes so this code should work:<BR><BR>if Request.Form("EmpAdmin") = "ON" then<BR>strAdmin = -1<BR>End if<BR><BR>as long as strAdmin is the BOOLEAN field you will update in Access 97<BR><BR>HTH <BR>Richard.<BR><BR>where Name is the checkbox field

Posting Permissions

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