What is the correct way to do this ?

Results 1 to 2 of 2

Thread: What is the correct way to do this ?

  1. #1
    Join Date
    Dec 1969

    Default What is the correct way to do this ?

    Hi I have a true/false field in Access. It is connected to a checkbox. What I am trying to do is to say that if the field is true then set the checkbox as "Checked" so that when a user returns to the page he can see his previous settings.<BR><BR>Below is my code but for some reason it does not work. I know I am close but I need a little help.<BR><BR>Thanks <BR><BR>Dwane Lumley<BR><BR>----------------<BR><BR>&#039Create connection<BR>set MyConn = server.CreateObject("ADODB.Connection")<BR>MyConn. Open "PROVIDER=MSDASQL;" & _<BR>"DRIVER={Microsoft Access Driver (*.mdb)}; " & _<BR>"DBQ=" & server.mappath("../db101/MnetPoll.mdb")<BR>&#039** Execute statement<BR>MySQL="Select * from Modules"<BR>Set MyRS=MyConn.Execute(MySQL)<BR><BR>While Not MyRs.EOF <BR>strCheckName = MyRs("ModName")<BR>bolModchecked = MyRs("ModChecked")<BR><BR>response.write MyRs("ModChecked") & "&lt;BR&gt;"<BR><BR>&#039See set the box to checked if it is then display it as checked in the browser.<BR>If BolModChecked = True then<BR>strChecked = "Checked"<BR>End If<BR><BR><BR><BR>%&#062; <BR> &#060;Input type="checkbox" name="&#060;%=strCheckName%&#062;" value="&#060;%=MyRs("ModPK")%&#062;" &#060;%=strChecked%&#062;&#062; &#060;%=strCheckName%&#062;<BR><BR> &#060;%<BR>MyRs.Movenext<BR>Wend<BR><BR><BR>%&#062 ;

  2. #2
    KPW Guest

    Default RE: What is the correct way to do this ?

    Have you verified that you are getting the value you expected? In your If...Then statement, you might try a response.write to ensure that the value is what you thought it was.<BR><BR>If BolModChecked = True Then<BR>Response.Write "True"<BR>strChecked = "checked"<BR>End If<BR><BR>This will help you confirm that you are getting True values from the field.<BR><BR>HTH

Posting Permissions

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