Link to home
Start Free TrialLog in
Avatar of polaatx
polaatxFlag for United States of America

asked on

Updating Access database from Radio Buttons value

Hi, I have the following radio buttons in an update page:

<input name="publicTransportation" type="radio" value="1">
Yes
<input name="publicTransportation" type="radio" value="0">
No</p>

They update an Access database yes/no field. I thought value of 1 means true. and 0 means false.

But regardless of what value the user chooses, the database always shows True (the checkbox in Access is always checked).

Any ideas on what I'm doing wrong? I am building it in DW. In the DW's Update dialog, I chose Checbox MS Access as data type. That didn't work. I chose Checkbox 1,0. as data type and that didn't work either.
Avatar of polaatx
polaatx
Flag of United States of America image

ASKER

I just tried it again with Checkbox -1,0 as datatype.

But no matter that user checks NO, Access always records it as True.
Avatar of cristy56
cristy56

you should put :

<input name="publicTransportation" type="radio" value="Y">
Yes
<input name="publicTransportation" type="radio" value="N">
No

instead.

Cristy
The yes/no datatype accepts "Y" or "N", but not numeric data such as "0" or "1"

Cristy
but when u select those Y/N field, u should made sqlstr as :
"select * from tablename where field = true"  

Cristy
sorry, I made some mistake, The correct version should be :

<input name="publicTransportation" type="radio" value=true>
Yes
<input name="publicTransportation" type="radio" value=false>
No

instead.

Cristy
Avatar of polaatx

ASKER

Cristy, thanks for your response.

Neither true/false or the Y/N solutions solved the problem. I am still getting True values in Access eventhough I am always checking no in the form.

Could it depend on the way ASP is inserting the data? Like the data type?

Probably you have "true" as the default value for the checkbox.

Could you post your database insert / update part of your ASP code?

:) SD
is the datatype in your Access database a Y/N field ? I just tried that and it works fine.
If u are still having problem, u can try one of the following :

1. post your code here and let us see if anything else goes wrong
or
2, change your Y/N field to char field with 1 character space only
and you can still put "Y" or "N" or even "0" or "1",

But I guess option 1 is better so we can see what's actually cozing trouble,

Cristy
maybe u can just test this statement inside your Access database to see if it works or not first :

INSERT INTO tablename ( field1, field2, field3 )
VALUES ("test", "234567", true);

where filed1, field2 are just char field and field3 is Y/N field

Cristy
Avatar of polaatx

ASKER

Hello experts. Here's my code. Sorry about all the DW superflous code. I am embarassed I have to use DW code but I'm an ASP illiterate.


<!--#include file="Connections/connSane1.asp" -->
<%
if request.Form("submit") = "Continue Application" AND request.Form("Agreement_Checkbox") = "" then
Response.Redirect("apply_error.asp")
end if




' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_connSane1_STRING
  MM_editTable = "tblUsers"
  MM_editColumn = "userID"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "apply_reference.asp?userID=" & request.Form("userID")
  MM_fieldsStr  = "Term_Applying_For|value|First_Name|value|Middle_Name|value|Last_Name|value|telephone|value|Street|value|City|value|Zip_Code|value|Institution_Currently_Enrolled|value|Class_Attending_Fall|value|College_GPA|value|Highschool_GPA|value|course1|value|institution1|value|grade1|value|course2|value|institution2|value|grade2|value|course3|value|institution3|value|grade3|value|course4|value|institution4|value|grade4|value|course5|value|institution5|value|grade5|value|course6|value|institution6|value|grade6|value|transportation|value|publicTransportation|value|Personal_Statement|value|notes1|value|Agreement_Checkbox|value|ip_address|value|dateEntered|value|userLevelID|value"
  MM_columnsStr = "termappliedFor|none,none,NULL|fname|',none,''|mname|',none,''|lname|',none,''|telephone|',none,''|street|',none,''|city|',none,''|state|',none,''|institution|none,none,NULL|classStanding|none,none,NULL|collegeGPA|',none,''|highschoolGPA|',none,''|course1|',none,''|institution1|',none,''|grade1|',none,''|course2|',none,''|institution2|',none,''|grade2|',none,''|course3|',none,''|institution3|',none,''|grade3|',none,''|course4|',none,''|institution4|',none,''|grade4|',none,''|course5|',none,''|institution5|',none,''|grade5|',none,''|course6|',none,''|institution6|',none,''|grade6|',none,''|transportation|none,-1,0|publicTransportation|none,-1,0|PersonalStatement|',none,''|notes1|',none,''|signature|none,1,0|ip_address|',none,''|dateEntered|',none,NULL|userLevelID|none,none,NULL"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%

Dim rsInstitutions
Dim rsInstitutions_numRows

Set rsInstitutions = Server.CreateObject("ADODB.Recordset")
rsInstitutions.ActiveConnection = MM_connSane1_STRING
rsInstitutions.Source = "SELECT * FROM tblInstitutions"
rsInstitutions.CursorType = 0
rsInstitutions.CursorLocation = 2
rsInstitutions.LockType = 1
rsInstitutions.Open()

rsInstitutions_numRows = 0
%>
<%
Dim rsClass
Dim rsClass_numRows

Set rsClass = Server.CreateObject("ADODB.Recordset")
rsClass.ActiveConnection = MM_connSane1_STRING
rsClass.Source = "SELECT * FROM tblClass"
rsClass.CursorType = 0
rsClass.CursorLocation = 2
rsClass.LockType = 1
rsClass.Open()

rsClass_numRows = 0
%>
<%
Dim rsTerm
Dim rsTerm_numRows

Set rsTerm = Server.CreateObject("ADODB.Recordset")
rsTerm.ActiveConnection = MM_connSane1_STRING
rsTerm.Source = "SELECT * FROM tblTerm ORDER BY term ASC"
rsTerm.CursorType = 0
rsTerm.CursorLocation = 2
rsTerm.LockType = 1
rsTerm.Open()

rsTerm_numRows = 0
%>
<%
Dim rsUsers__MMColParam
rsUsers__MMColParam = "1"
If (Request.QueryString("goodemail") <> "") Then
  rsUsers__MMColParam = Request.QueryString("goodemail")
End If
%>
<%
Dim rsUsers
Dim rsUsers_numRows

Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.ActiveConnection = MM_connSane1_STRING
rsUsers.Source = "SELECT email, userID FROM tblUsers WHERE email = '" + Replace(rsUsers__MMColParam, "'", "''") + "'"
rsUsers.CursorType = 0
rsUsers.CursorLocation = 2
rsUsers.LockType = 1
rsUsers.Open()

rsUsers_numRows = 0
%>




<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" id="form1" onSubmit="MM_validateForm('Term_Applying_For','','R','First_Name','','R','Last_Name','','R', 'Institution_Currently_Enrolled','','R','Telephone','','R','Street','','R','City','','R','State','','R','Zip_Code','','RisNum','Class_Attending_Fall','','R','College_GPA','','R','Highschool_GPA','','R','Personal_Statement','','R','Agreement_Checkbox','','R');return document.MM_returnValue">
<h3>Step 3: Personal & Academic Information </h3>
<h4>Term<span class="alert" style="font-size:11px">&nbsp;(required)</span><sup>*</sup></h4><br>
<table width="420"cellpadding="6" cellspacing="0"><tr><td align="right">Term you are applying for:<sup>*</sup></td><td>
<select name="Term_Applying_For" id="Term_Applying_For">
<option value="">Choose Term</option>
<%
While (NOT rsTerm.EOF)
%>
<option value="<%=(rsTerm.Fields.Item("termID").Value)%>"><%=(rsTerm.Fields.Item("term").Value)%></option>
<%
  rsTerm.MoveNext()
Wend
If (rsTerm.CursorType > 0) Then
  rsTerm.MoveFirst
Else
  rsTerm.Requery
End If
%>
</select>
</td></tr></table>


<h4>Personal Information</h4><br>
<table width="420" cellpadding="6" cellspacing="0"><tr>
<td align="right"> First Name:<sup>*</sup></td><td>
<input name="First_Name" type="text" id="First_Name" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="25">
 </td>
 </tr>
 <tr>
<td align="right"> Middle Name: </td><td align="left">
<input name="Middle_Name" type="text" id="Middle_Name"  onFocus="this.className='currentField'" onChange="this.className='changedField'" size="25"/>
</td></tr>
<tr>
<td align="right"> Last Name:<sup>*</sup></td><td>
<input name="Last_Name" type="text" id="Last_Name" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="25" />
 </td>
</tr>
<tr>
<td align="right"> Telephone:<sup>*</sup></td><td>
<input name="telephone" type="text" id="telephone" onFocus="this.className='currentField'" onChange="this.className='changedField'" value="" size="25">
 </td>
</tr>
<tr>
<td align="right"> Street:<sup>*</sup></td><td>
<textarea name="Street" cols="20" rows="2" id="Street" onFocus="this.className='currentField'" onChange="this.className='changedField'"></textarea>
 </td></tr>
 <tr>
<td align="right"> City:<sup>*</sup></td><td>
<input name="City" type="text" id="City" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="25" />
 </td></tr><tr>
<td align="right"> State:<sup>*</sup></td><td>
<input name="State" type="text" id="State" onFocus="this.className='currentField'" onChange="this.className='changedField'" value="Georgia" size="9" />
 </td>
 </tr>
 
<td align="right"> Zip Code:<sup>*</sup></td><td> <input name="Zip_Code" type="text" id="zip2" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="5" maxlength="5" />
 </td>
</tr></table>
<h4>Your Academic Standing</h4><br>
<table width="420" cellpadding="6" cellspacing="0"><tr>
<td align="right"> Institution currently attending:<sup>*</sup></td><td>

<select name="Institution_Currently_Enrolled" id="Institution_Currently_Enrolled">
<option value="">Choose Institution</option>
<%
While (NOT rsInstitutions.EOF)
%>
<option value="<%=(rsInstitutions.Fields.Item("instID").Value)%>"><%=(rsInstitutions.Fields.Item("instName").Value)%></option>
<%
  rsInstitutions.MoveNext()
Wend
If (rsInstitutions.CursorType > 0) Then
  rsInstitutions.MoveFirst
Else
  rsInstitutions.Requery
End If
%>
</select>
 </td><tr>
<td align="right"> Class Standing for Fall 2004:<sup>*</sup></td><td>
<select name="Class_Attending_Fall" id="Class_Attending_Fall">
<option value="">Choose Class Standing</option>
<%
While (NOT rsClass.EOF)
%>
<option value="<%=(rsClass.Fields.Item("classID").Value)%>"><%=(rsClass.Fields.Item("class").Value)%></option>
<%
  rsClass.MoveNext()
Wend
If (rsClass.CursorType > 0) Then
  rsClass.MoveFirst
Else
  rsClass.Requery
End If
%>
</select>
 </td></tr><tr>
<td align="right">
Overall College GPA:<sup>*</sup></td><td>
<input name="College_GPA" type="text" id="College_GPA" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="5" maxlength="5" />
</td></tr><tr>

<td align="right">
Overall High School GPA:<sup>*</sup></td><td>
<input name="Highschool_GPA" type="text" id="Highschool_GPA" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="5" maxlength="5" />
</td>
</tr></table>
<p>List all science courses you have taken and grade received in the course.  List courses you are currently taking by marking an (X) after the course name. </p>

<table width="420" cellpadding="6" cellspacing="0">
<tr>
<td>Course</td>
<td>Institution</td>
<td>Grade</td>
</tr>
<tr>
<td><input name="course1" type="text" id="course1" size="35" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="institution1" type="text" id="institution1" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="grade1" type="text" id="grade1" size="5" maxlength="5"onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
</tr>
<tr>
<tr>
<td><input name="course2" type="text" id="course1" size="35" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="institution2" type="text" id="institution2" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="grade2" type="text" id="grade2" size="5" maxlength="5" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
</tr>
<tr>
<tr>
<td><input name="course3" type="text" id="course3" onFocus="this.className='currentField'" onChange="this.className='changedField'" size="35"></td>
<td><input name="institution3" type="text" id="institution32" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="grade3" type="text" id="grade32" size="5" maxlength="5" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
</tr>
<tr>
<tr>
<td><input name="course4" type="text" id="course4" size="35" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="institution4" type="text" id="institution43" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="grade4" type="text" id="grade4" size="5" maxlength="5" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
</tr>
<tr>
<tr>
<td><input name="course5" type="text" id="course5" size="35" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="institution5" type="text" id="institution5" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="grade5" type="text" id="grade5" size="5" maxlength="5" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
</tr>
<tr>
<tr>
<td><input name="course6" type="text" id="course6" size="35" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="institution6" type="text" id="institution6" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
<td><input name="grade6" type="text" id="grade62" size="5" maxlength="5" onFocus="this.className='currentField'" onChange="this.className='changedField'"></td>
</tr>
<tr>

</table>

<h4>Transportation</h4>
<p>Do you have transportation to another institution?
&nbsp;&nbsp;
<input name="transportation" type="radio" value="True">
Yes  
<input name="transportation" type="radio" value="False">
No
</p>
<p>
Do you have access to public transportation?
&nbsp;&nbsp;
<input name="publicTransportation" type="radio" value="True">
Yes
<input name="publicTransportation" type="radio" value="False">
No</p>
<h4>Personal Statement<sup>*</sup></h4>

<p>Describe your reasons for wishing to participate in the AURA Fellows program.
Indicate how this opportunity will influence and contribute to your current and
future fields of study. Comment on how this program will impact your career aspirations.
You can copy and paste from another document. If needed, the field below will
scroll down and hold more information. </p>


<p>
<textarea name="Personal_Statement" cols="65" rows="10" wrap="VIRTUAL" id="Personal_Statement" onFocus="this.className='currentField'" onChange="this.className='changedField'"></textarea>
</p>
<p> Is there a particular project or research area that interests you?  </p>
<p>
<textarea name="notes1" cols="65" rows="4" wrap="VIRTUAL" id="notes1" onFocus="this.className='currentField'" onChange="this.className='changedField'"></textarea>
</p>
<h4>Agreement<sup>*</sup></h4>
<p> <input name="Agreement_Checkbox" type="checkbox" id="Agreement_Checkbox" value="Y">
&nbsp;I understand and agree that upon acceptance into the AURA Fellows program, my compensation is dependent on my complete participation in the research program which includes a weekly commitment of 8-10 hours of research per week, attendance at a minimum of 2 special seminars, participation in the AURA poster symposium and the completion of pre and post-evaluation surveys.  </p>
<td>
<input type="submit" name="Submit" value="Continue Application">
<input name="ip_address" type="hidden" id="ip_address" value="<%= Request.ServerVariables ("REMOTE_ADDR")%>">
<input name="dateEntered" type="hidden" value="<%=date%>">
<input type="hidden" name="userLevelID" value="2">
<input name="userID" type="hidden" id="userID" value="<%=(rsUsers.Fields.Item("userID").Value)%>">
<input name="formsubmitted" type="hidden" id="formsubmitted" value="yes">
</td>




<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= rsUsers.Fields.Item("userID").Value %>">
</form>

</body></html>
<%
rsInstitutions.Close()
Set rsInstitutions = Nothing
%>
<%
rsClass.Close()
Set rsClass = Nothing
%>
<%
rsTerm.Close()
Set rsTerm = Nothing
%>
<%
rsUsers.Close()
Set rsUsers = Nothing
%>
SOLUTION
Avatar of cristy56
cristy56

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of polaatx

ASKER

Cristy, that's the way DW writes the code. I think -1,0 stands for the type of checkbox I chose when I had DW write the Insert statement. It provides for several types of checkbox. And I tried Checkbox -1,0, checkbox 1,0, and one that it called Checkbox Access. None of them worked.

Here's the code:


' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_connSane1_STRING
  MM_editTable = "tblUsers"
  MM_editColumn = "userID"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "apply_reference.asp?userID=" & request.Form("userID")
  MM_fieldsStr  = "Term_Applying_For|value|First_Name|value|Middle_Name|value|Last_Name|value|telephone|value|Street|value|City|value|Zip_Code|value|Institution_Currently_Enrolled|value|Class_Attending_Fall|value|College_GPA|value|Highschool_GPA|value|course1|value|institution1|value|grade1|value|course2|value|institution2|value|grade2|value|course3|value|institution3|value|grade3|value|course4|value|institution4|value|grade4|value|course5|value|institution5|value|grade5|value|course6|value|institution6|value|grade6|value|transportation|value|publicTransportation|value|Personal_Statement|value|notes1|value|Agreement_Checkbox|value|ip_address|value|dateEntered|value|userLevelID|value"
  MM_columnsStr = "termappliedFor|none,none,NULL|fname|',none,''|mname|',none,''|lname|',none,''|telephone|',none,''|street|',none,''|city|',none,''|state|',none,''|institution|none,none,NULL|classStanding|none,none,NULL|collegeGPA|',none,''|highschoolGPA|',none,''|course1|',none,''|institution1|',none,''|grade1|',none,''|course2|',none,''|institution2|',none,''|grade2|',none,''|course3|',none,''|institution3|',none,''|grade3|',none,''|course4|',none,''|institution4|',none,''|grade4|',none,''|course5|',none,''|institution5|',none,''|grade5|',none,''|course6|',none,''|institution6|',none,''|grade6|',none,''|transportation|none,-1,0|publicTransportation|none,-1,0|PersonalStatement|',none,''|notes1|',none,''|signature|none,1,0|ip_address|',none,''|dateEntered|',none,NULL|userLevelID|none,none,NULL"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
Sorry, I don't quite understand the DW code.

But I just find out one thing, when u insert data to your table, the value for transportation should be true or false in the insert statement, instead of "true" or "false".
there should not be any quotaion "" for the true or false. I am not sure if this is the point where your problem occurs. I am sorry that I can't help u much in this question.

Cristy
Please try to do this if you havent still solved ur problem.

Before inserting data into the table check that you are recieving the right value by printing them on screen.
Then you may try to CInt or define them true or false by case.
..
use true or false

I believe Access knows the difference and knows how to convert true/false to yes/no.
Make sure though that the true/false is NOT passed as a string.

So your first bit on the form is:

<input name="publicTransportation" type="radio" value="true">Yes
<input name="publicTransportation" type="radio" value="false"> No

and on your second page:

sPublicTrans = CBool(request.form("publicTransportation"))

This will take the true/false as a string and convert it into true/false as a bool. When writing this to the DB access should store it ok.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of polaatx

ASKER

Hi alorentz,

I tried changing to

<input name="publicTransportation" type="radio" value="Yes">
Yes
<input name="publicTransportation" type="radio" value="No">
No</p>

and the problem continues. Access keeps recording true regardless of what the user checks.

JagC: Do you know where in my code I should put sPublicTrans = CBool(request.form("publicTransportation")) ?

I tried building a form and I definetly getting the value of True and False or Yes/No: http://www.aurafellows.net/aura/testForm.asp
Then the problem in the SQL that Dreamweaver built....of course :)
sPublicTrans = CBool(request.form("publicTransportation"))

goes, er, yeah, dreamweaver code. We had a site built entirely from DW stuff - 2 months later I ripped it apart and rewote it...

k, ignore what I said.

try changing:

  MM_columnsStr = "termappliedFor|none,none,NULL|fname|',none,''|mname|',none,''|lname|',none,''|telephone|',none,''|street|',none,''|city|',none,''|state|',none,''|institution|none,none,NULL|classStanding|none,none,NULL|collegeGPA|',none,''|highschoolGPA|',none,''|course1|',none,''|institution1|',none,''|grade1|',none,''|course2|',none,''|institution2|',none,''|grade2|',none,''|course3|',none,''|institution3|',none,''|grade3|',none,''|course4|',none,''|institution4|',none,''|grade4|',none,''|course5|',none,''|institution5|',none,''|grade5|',none,''|course6|',none,''|institution6|',none,''|grade6|',none,''|transportation|none,-1,0|publicTransportation|none,-1,0|PersonalStatement|',none,''|notes1|',none,''|signature|none,1,0|ip_address|',none,''|dateEntered|',none,NULL|userLevelID|none,none,NULL"

to

  MM_columnsStr = "termappliedFor|none,none,NULL|fname|',none,''|mname|',none,''|lname|',none,''|telephone|',none,''|street|',none,''|city|',none,''|state|',none,''|institution|none,none,NULL|classStanding|none,none,NULL|collegeGPA|',none,''|highschoolGPA|',none,''|course1|',none,''|institution1|',none,''|grade1|',none,''|course2|',none,''|institution2|',none,''|grade2|',none,''|course3|',none,''|institution3|',none,''|grade3|',none,''|course4|',none,''|institution4|',none,''|grade4|',none,''|course5|',none,''|institution5|',none,''|grade5|',none,''|course6|',none,''|institution6|',none,''|grade6|',none,''|transportation|none,-1,0|publicTransportation|none,-1,0|PersonalStatement|',none,''|notes1|',none,''|signature|none,true,false|ip_address|',none,''|dateEntered|',none,NULL|userLevelID|none,none,NULL"
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of polaatx

ASKER

JagC,

|transportation|none,false,true|publicTransportation|none,false,true|

inserts NO all the time.

|transportation|none,true,false |publicTransportation|none,true,false |

inserts Yes all the time.

This is weird.
Avatar of polaatx

ASKER

I just built another form with DW insert statement and tried all kinds of different combinations: http://www.aurafellows.net/aura/testForm_insert.asp

http://www.aurafellows.net/aura/testForm_insert.asp

  MM_columnsStr = "publicTransport|none,0,1"
  MM_columnsStr = "publicTransport|none,1,0"
  MM_columnsStr = "publicTransport|none,0,-1"
  MM_columnsStr = "publicTransport|none,0,-1"
  MM_columnsStr = "publicTransport|none,true,false"
  MM_columnsStr = "publicTransport|none,true,false"

All of above either produce true all the time or false all the time.

html is:

<form name="form1" action="<%=MM_editAction%>" method="POST">
<p>Do you have transportation to another institution?
&nbsp;&nbsp;
<input name="publicTransportation" type="radio" value="Yes">
Yes  
<input name="publicTransportation" type="radio" value="No">
No
</p>
<p><input name="submit" type="submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
Avatar of polaatx

ASKER

Any more ideas? I'm still stuck with this problem. Haven't been able to find any answers else where on the web.
Avatar of polaatx

ASKER

I found the answer to this problem on the DW forum on Macromedia site.

Turns out for radio buttons, in DW one has to have the insert dialog submit the data as TEXT.

What is the procedure for closing a question if I found my answer elsewhere?