ASP/Html checkbox convert to true/false for MS Access backend

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • joecosmides@gmail.com

    ASP/Html checkbox convert to true/false for MS Access backend

    I have a microsoft access front end and backend database for multi-
    user use. I have the back end located on a server that also is an IIS
    webserver. I've created a few ASP pages that pull customer lists down
    so far and it works great. I am trying to edit some of that data and
    noticed that a checkbox on the webpage uses ON/OFF instead of True/
    False like MS Access uses. My problem is trying to get the checkbox
    to
    be checked if the data in the field called "ServiceCallBac k" is
    pulled
    and shown to be True. If False then it would uncheck the box.

    Thanks,

    Here is the code I have on that webpage:


    <%


    ID = Request("ID")
    ID = CLng(ID)


    %>
    <!--#include file="database-connect.asp"-->
    <%
    SQL = "SELECT * FROM Support2Q WHERE LeadDetailID=" & ID
    RS.Open SQL, Conn


    ServiceNotes = rs("ServiceNote s")
    ServiceCallBack = rs("ServiceCall Back")
    ServiceCallBack Time = rs("ServiceCall BackTime")
    Customer = rs("Customer")
    ContractorName = rs("ContractorN ame")


    %>
    <!--#include file="database-disconnect.asp"-->


    <html>
    <body>


    <form method="POST" action="editpro cess.asp">
    <tr>
    <td width="130">Lea dDetailID:</td>
    <td width="267"><in put type="hidden" name="ID" value="<%=ID%>"
    size="25"></td>
    <p>
    </tr>
    <tr>
    <td width="130">Cus tomer:</td>
    <td width="267">
    <input type="text" name="Customer" value="<%=Custo mer%>"
    size="57"></td>
    </tr>
    <tr>
    <td width="130">&nb sp;&nbsp;&nbsp; </p>
    <p>
    Contractor Name:</td>
    <td width="267">
    <input type="text" name="Contracto rName" value="<%=Contr actorName
    %>" size="50"></td></p>
    <p>
    Notes: <textarea rows="8" name="ServiceNo tes" cols="86"><
    %=ServiceNotes% ></textarea></p>


    <p>Call Back?
    <input type="checkbox" name="ServiceCa llBack" value="<
    %=ServiceCallBa ck%>"></p>


    <p>Call Back When?</td>
    <td width="267"><in put type="text" name="ServiceCa llBackTime"
    value="<%=Servi ceCallBackTime% >" size="50"></td></p>


    <p><input type="submit" value="Submit" name="B1"></p>
    </form>
    </body>
    </html>


  • sloan

    #2
    Re: ASP/Html checkbox convert to true/false for MS Access backend


    This is a newsgroup for asp.NET , not "classic" asp.

    However, you did remind me how VERY THANKFUL I am for Asp.Net.

    ..........

    You'll find better luck in another newsgroup.

    Maybe this one:
    microsoft.publi c.inetserver.as p.general



    <joecosmides@gm ail.comwrote in message
    news:a6f399fe-9da8-4d59-8001-7607684ceab9@d1 0g2000pra.googl egroups.com...
    >I have a microsoft access front end and backend database for multi-
    user use. I have the back end located on a server that also is an IIS
    webserver. I've created a few ASP pages that pull customer lists down
    so far and it works great. I am trying to edit some of that data and
    noticed that a checkbox on the webpage uses ON/OFF instead of True/
    False like MS Access uses. My problem is trying to get the checkbox
    to
    be checked if the data in the field called "ServiceCallBac k" is
    pulled
    and shown to be True. If False then it would uncheck the box.
    >
    Thanks,
    >
    Here is the code I have on that webpage:
    >
    >
    <%
    >
    >
    ID = Request("ID")
    ID = CLng(ID)
    >
    >
    %>
    <!--#include file="database-connect.asp"-->
    <%
    SQL = "SELECT * FROM Support2Q WHERE LeadDetailID=" & ID
    RS.Open SQL, Conn
    >
    >
    ServiceNotes = rs("ServiceNote s")
    ServiceCallBack = rs("ServiceCall Back")
    ServiceCallBack Time = rs("ServiceCall BackTime")
    Customer = rs("Customer")
    ContractorName = rs("ContractorN ame")
    >
    >
    %>
    <!--#include file="database-disconnect.asp"-->
    >
    >
    <html>
    <body>
    >
    >
    <form method="POST" action="editpro cess.asp">
    <tr>
    <td width="130">Lea dDetailID:</td>
    <td width="267"><in put type="hidden" name="ID" value="<%=ID%>"
    size="25"></td>
    <p>
    </tr>
    <tr>
    <td width="130">Cus tomer:</td>
    <td width="267">
    <input type="text" name="Customer" value="<%=Custo mer%>"
    size="57"></td>
    </tr>
    <tr>
    <td width="130">&nb sp;&nbsp;&nbsp; </p>
    <p>
    Contractor Name:</td>
    <td width="267">
    <input type="text" name="Contracto rName" value="<%=Contr actorName
    %>" size="50"></td></p>
    <p>
    Notes: <textarea rows="8" name="ServiceNo tes" cols="86"><
    %=ServiceNotes% ></textarea></p>
    >
    >
    <p>Call Back?
    <input type="checkbox" name="ServiceCa llBack" value="<
    %=ServiceCallBa ck%>"></p>
    >
    >
    <p>Call Back When?</td>
    <td width="267"><in put type="text" name="ServiceCa llBackTime"
    value="<%=Servi ceCallBackTime% >" size="50"></td></p>
    >
    >
    <p><input type="submit" value="Submit" name="B1"></p>
    </form>
    </body>
    </html>
    >
    >

    Comment

    • Paul Shapiro

      #3
      Re: ASP/Html checkbox convert to true/false for MS Access backend

      Here is code I used in an ASP project. I built the html completely in code,
      but the key part seems to be using the HTML "checked" setting for a check
      box. In Access a boolean attribute has a value of 0 for False, Off, No, etc.
      and -1 for True, On, Yes. The names are just part of the display format, not
      the real data.

      strHTML = strHTML & "<tr>" & vbcrlf & _
      "<td>Invite d Paper?</td>" & vbCrLf & _
      "<td><INPUT type=checkbox name=chkInvited "
      if fInvited then
      strHTML = strHTML & "checked" & vbcrlf
      end if

      <joecosmides@gm ail.comwrote in message
      news:a6f399fe-9da8-4d59-8001-7607684ceab9@d1 0g2000pra.googl egroups.com...
      >I have a microsoft access front end and backend database for multi-
      user use. I have the back end located on a server that also is an IIS
      webserver. I've created a few ASP pages that pull customer lists down
      so far and it works great. I am trying to edit some of that data and
      noticed that a checkbox on the webpage uses ON/OFF instead of True/
      False like MS Access uses. My problem is trying to get the checkbox
      to
      be checked if the data in the field called "ServiceCallBac k" is
      pulled
      and shown to be True. If False then it would uncheck the box.
      >
      Thanks,
      >
      Here is the code I have on that webpage:
      >
      >
      <%
      >
      >
      ID = Request("ID")
      ID = CLng(ID)
      >
      >
      %>
      <!--#include file="database-connect.asp"-->
      <%
      SQL = "SELECT * FROM Support2Q WHERE LeadDetailID=" & ID
      RS.Open SQL, Conn
      >
      >
      ServiceNotes = rs("ServiceNote s")
      ServiceCallBack = rs("ServiceCall Back")
      ServiceCallBack Time = rs("ServiceCall BackTime")
      Customer = rs("Customer")
      ContractorName = rs("ContractorN ame")
      >
      >
      %>
      <!--#include file="database-disconnect.asp"-->
      >
      >
      <html>
      <body>
      >
      >
      <form method="POST" action="editpro cess.asp">
      <tr>
      <td width="130">Lea dDetailID:</td>
      <td width="267"><in put type="hidden" name="ID" value="<%=ID%>"
      size="25"></td>
      <p>
      </tr>
      <tr>
      <td width="130">Cus tomer:</td>
      <td width="267">
      <input type="text" name="Customer" value="<%=Custo mer%>"
      size="57"></td>
      </tr>
      <tr>
      <td width="130">&nb sp;&nbsp;&nbsp; </p>
      <p>
      Contractor Name:</td>
      <td width="267">
      <input type="text" name="Contracto rName" value="<%=Contr actorName
      %>" size="50"></td></p>
      <p>
      Notes: <textarea rows="8" name="ServiceNo tes" cols="86"><
      %=ServiceNotes% ></textarea></p>
      >
      >
      <p>Call Back?
      <input type="checkbox" name="ServiceCa llBack" value="<
      %=ServiceCallBa ck%>"></p>
      >
      >
      <p>Call Back When?</td>
      <td width="267"><in put type="text" name="ServiceCa llBackTime"
      value="<%=Servi ceCallBackTime% >" size="50"></td></p>
      >
      >
      <p><input type="submit" value="Submit" name="B1"></p>
      </form>
      </body>
      </html>
      >
      >

      Comment

      Working...