Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    ASP Pages from Forms (XP/2K)

    I am almost finished developing an app. The client now wants to put some of the forms as web accessible pages to a Pocket PC with a wireless modem. Can I just save those forms as ASP pages and then move them to the server? Any other brilliant ideas. I am starting to swim in new waters here. Any help would be appreciated, including links to anything useful.

  2. #2
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ASP Pages from Forms (XP/2K)

    I recently had two projects which prompted the code below. The first was my WolfWeb, which 'watches' and mimics Access dialog boxes, on the web. It runs the Access database on one machine, and shows the web user the various dialog boxes that pop up. It works great for most of our internet 'reporting' databases. However, Access forms are a different beast from a dialog window. So I started writing code to handle the creation of HTML versions of an Access form (the Northwind database uses forms for report criteria.....go figure).

    The second project, was for a developer I sub contract with sometimes. He had a client that wanted an Access form on the web. So I polished up the code below, and made the initial 'web page'. That project ended up going a different direction, because the form they REALLY wanted didn't look anything like the Access form, so I created what they really wanted with just HTML tables. Came out quite nicely.

    However, the trick is getting the form to actually 'work'. What I ended up doing in the final version of the last project I mentioned, was to create a .dll, that had a few classes. The one class had a 'Value' property, that you fed the recordsource field name too. The code then used a lookup table to determine what type of control was involved (textbox, combo, etc.). It then returned the appropriate HTML for that control. It also had three modes, View, Edit, and New. What was returned was also dependant upon the mode. Everything was just returned as text (except for checkboxes) in View mode. In New and Edit, textboxes were returned as Text inputs, combo's as selects, etc. The combo's were the more interesting portion, because each combo required different data in it's list. So I used Implements to create a combo class, then in the previously mentioned lookup table, I put the actual class for that combo. That class was designed to create a full HTML version of the contents of a combo. And, since it used a lookup table and implements, I could add combo boxes on the fly, without messing with the original code.

    When a user submitted changes, or new records, there was one trick. I would pull up the recordset, and then force feed BACK to the ASP, the list of field names. The return of that process took the feedback, and resubmitted to the .dll the value of that control (since the controls were named after the fields they represented).

    Hopefully this is enough to get you started.

    Function WriteHTML(strFormName As String)
    Dim strHTML As String
    Dim strStyle As String
    Dim f As Long
    Dim ctrl As Control
    Dim frm As Form
    Dim ttp As Long
    ttp = 16
    Set frm = Forms(strFormName)
    strHTML = "<HTML>" & vbCrLf & _
    "<form name=""frmDyncorpM3041"" Method=""POST"" Action=""returncriteria.asp"">" & vbCrLf & _
    "<table border=""1"" width=""" & frm.WindowWidth / ttp & """ height=""" & _
    frm.WindowHeight / ttp & """ bgcolor=""#C0C0C0"" style=""position: absolute; left: 15; top: 15"">" & vbCrLf & _
    "<tr>" & vbCrLf & _
    "<td height=""10"" bgcolor=""#0000FF""><font color=""#FFFFFF"">" & frm.Caption & _
    "</font></td>" & vbCrLf & "</tr>" & vbCrLf & "<tr>" & vbCrLf & "<td height=""" & _
    (frm.WindowHeight - 25) / ttp & """>

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ASP Pages from Forms (XP/2K)

    Thanks for the help. Time to learn some new tricks

  4. #4
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ASP Pages from Forms (XP/2K)

    Good luck! <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

Posting Permissions

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