SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Data Type Mismatch

    Hi Guys! I'm working on an asp Insert page and I've received the following error message:
    Microsoft JET Database Engine error '80040e07'
    Data type mismatch in criteria expression.

    "Currently, the only known work around available is to avoid inserting and/or updating columns of "Date/Time" data types in Access with empty strings, ("") or with any other value that does not correspond to the range of values specified for the data type."

    This is rather confusing to me because even though my Access table used to contain a field of Date/Time type, I deleted that field but I'm still getting the error. Currently, the database field types are text, numeric, or yes/no. Why is the error still being produced?

    Thanks for your ideas!

  2. #2
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you post the code?

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi 'D! Hope all is well across the Atlantic

    Voila! Here's the code ....

    <%@LANGUAGE="VBSCRIPT"%>
    <!--#include file="Connections/connProperties.asp" -->
    <%
    ' *** Edit Operations: declare variables

    MM_editAction = CStr(Request("URL"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Request.QueryString
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

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

    If (CStr(Request("MM_insert")) <> "") Then

    MM_editConnection = MM_connProperties_STRING
    MM_editTable = "PropertiesFull"
    MM_editRedirectUrl = "addsuccess.asp"
    MM_fieldsStr = "txtAdNum|value|txtPrice|value|txtDues|value|txtAddress|value|txtCity|value|mnuState|value|txtZip|value|txtCounty|value|txtNeighborhood|value|txtMLS|value|txtYear|value|txtDescrip|value|txtLot|value|txtSqFt|value|txtFloors|value|txtBed|value|txtBath|value|txtRooms|value|optCommercial|value|optCondo|value|optDuplex|value|optFarm|value|optFarmRanch|value|optHouseboat|value|optLand|value|optMobileHome|value|optMultiFamily|value|optSingleFamily|value|optTH|value|optCommercialStatus|value|optForRent|value|optForSale|value|optForeclosure|value|optLandForSale|value|optLotForSale|value|optSold|value|optUnderContract|value|txtCustomStatus|value|optAttGar|value|optDetGar|value|optCarport|value|optOffSt|value|optOnSt|value|txtNumCars|value"
    MM_columnsStr = "AdNum|none,none,NULL|Price|none,none,NULL|AssociationDues|none,none,NULL|Address|',none,''|City|',none,''|State|',none,''|Zip|',none,''|County|',none,''|Neighborhood|',none,''|MLSArea|none,none,NULL|YearBuilt|none,none,NULL|Description|',none,''|LotSize|',none,''|HeatedSquareFeet|none,none,NULL|Floors|none,none,NULL|Bedrooms|none,none,NULL|Bathrooms|none,none,NULL|Rooms|none,none,NULL|Commercial|none,'Y','N'|Condo|none,'Y','N'|Duplex|none,'Y','N'|Farm|none,'Y','N'|FarmRanch|none,'Y','N'|HouseBoat|none,'Y','N'|Land|none,'Y','N'|MobileHome|none,'Y','N'|Multifamily|none,'Y','N'|SingleFamily|none,'Y','N'|Townhouse|none,'Y','N'|CommercialStatus|none,'Y','N'|ForRent|none,'Y','N'|ForSale|none,'Y','N'|Foreclosure|none,'Y','N'|LandForSale|none,'Y','N'|LotForSale|none,'Y','N'|Sold|none,'Y','N'|UnderContract|none,'Y','N'|CustomStatus|',none,''|AttachedGarage|none,'Y','N'|DetachedGarage|none,'Y','N'|Carport|none,'Y','N'|OffStreet|none,'Y','N'|OnStreet|none,'Y','N'|Vehicles|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 i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(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
    %>
    <%
    ' *** Insert Record: construct a sql insert statement and execute it

    If (CStr(Request("MM_insert")) <> "") Then

    ' create the sql insert statement
    MM_tableValues = ""
    MM_dbValues = ""
    For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
    FormVal = EmptyVal
    Else
    If (AltVal <> "") Then
    FormVal = AltVal
    ElseIf (Delim = "'") Then ' escape quotes
    FormVal = "'" & Replace(FormVal,"'","''") & "'"
    Else
    FormVal = Delim + FormVal + Delim
    End If
    End If
    If (i <> LBound(MM_fields)) Then
    MM_tableValues = MM_tableValues & ","
    MM_dbValues = MM_dbValues & ","
    End if
    MM_tableValues = MM_tableValues & MM_columns(i)
    MM_dbValues = MM_dbValues & FormVal
    Next
    MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

    If (Not MM_abortEdit) Then
    ' execute the insert
    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
    %>
    <%
    set rsInsert = Server.CreateObject("ADODB.Recordset")
    rsInsert.ActiveConnection = MM_connProperties_STRING
    rsInsert.Source = "SELECT * FROM PropertiesFull"
    rsInsert.CursorType = 0
    rsInsert.CursorLocation = 2
    rsInsert.LockType = 3
    rsInsert.Open()
    rsInsert_numRows = 0
    %>
    <html>
    <head>
    <title>Brett Knowles Real Estate - Add A New Property</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <form name="frmInsert" method="POST" action="<%=MM_editAction%>">
    <h2 align="center">Add A New Property</h2>
    <h3 align="center">Property Information</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="38%">
    <div align="right">Ad Number</div>
    </td>
    <td width="62%">
    <input type="text" name="txtAdNum" value="<%=(rsInsert.Fields.Item("AdNum").Value)%>">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Today's Date<br>
    <font size="1">month/day/four digit year.</font></div>
    </td>
    <td width="62%">&nbsp; </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Price<br>
    <font size="1">Do not use $ sign, enter numbers only.</font> </div>
    </td>
    <td width="62%">
    <input type="text" name="txtPrice" value="<%=(rsInsert.Fields.Item("Price").Value)%>">
    <br>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Association Dues<br>
    <font size="1">Do not use $ sign, enter numbers only.</font> </div>
    </td>
    <td width="62%">
    <input type="text" name="txtDues" value="<%=(rsInsert.Fields.Item("AssociationDues").Value)%>">
    <br>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Address</div>
    </td>
    <td width="62%">
    <input type="text" name="txtAddress" value="<%=(rsInsert.Fields.Item("Address").Value)%>" size="24">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">City</div>
    </td>
    <td width="62%">
    <input type="text" name="txtCity" value="<%=(rsInsert.Fields.Item("City").Value)%>" size="24">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">State</div>
    </td>
    <td width="62%">
    <select name="mnuState">
    <option value="AK" selected>AK</option>
    <option value="AL">AL</option>
    <option value="AR">AR</option>
    <option value="AZ">AZ</option>
    <option value="CA">CA</option>
    <option value="CO">CO</option>
    <option value="CT">CT</option>
    <option value="DC">DC</option>
    <option value="DE">DE</option>
    <option value="FL">FL</option>
    <option value="GA">GA</option>
    <option value="HI">HI</option>
    <option value="IA">IA</option>
    <option value="ID">ID</option>
    <option value="IL">IL</option>
    <option value="IN">IN</option>
    <option value="KS">KS</option>
    <option value="KY">KY</option>
    <option value="LA">LA</option>
    <option value="MA">MA</option>
    <option value="MD">MD</option>
    <option value="ME">ME</option>
    <option value="MI">MI</option>
    <option value="MN">MN</option>
    <option value="MO">MO</option>
    <option value="MS">MS</option>
    <option value="MT">MT</option>
    <option value="NC">NC</option>
    <option value="ND">ND</option>
    <option value="NE">NE</option>
    <option value="NH">NH</option>
    <option value="NJ">NJ</option>
    <option value="NM">NM</option>
    <option value="NV">NV</option>
    <option value="NY">NY</option>
    <option value="OH">OH</option>
    <option value="OK">OK</option>
    <option value="OR">OR</option>
    <option value="PA">PA</option>
    <option value="RI">RI</option>
    <option value="SC">SC</option>
    <option value="SD">SD</option>
    <option value="TN">TN</option>
    <option value="TX">TX</option>
    <option value="UT">UT</option>
    <option value="VT">VT</option>
    <option value="VA">VA</option>
    <option value="WA">WA</option>
    <option value="WI">WI</option>
    <option value="WV">WV</option>
    <option value="WY">WY</option>
    <%
    While (NOT rsInsert.EOF)
    %>
    <option value="<%=(rsInsert.Fields.Item("State").Value)%>" ><%=(rsInsert.Fields.Item("State").Value)%></option>
    <%
    rsInsert.MoveNext()
    Wend
    If (rsInsert.CursorType > 0) Then
    rsInsert.MoveFirst
    Else
    rsInsert.Requery
    End If
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Zip</div>
    </td>
    <td width="62%">
    <input type="text" name="txtZip" value="<%=(rsInsert.Fields.Item("Zip").Value)%>" size="10">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">County</div>
    </td>
    <td width="62%">
    <input type="text" name="txtCounty" value="<%=(rsInsert.Fields.Item("County").Value)%>">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Neighborhood</div>
    </td>
    <td width="62%">
    <input type="text" name="txtNeighborhood" value="<%=(rsInsert.Fields.Item("Neighborhood").Value)%>">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">MLS Area</div>
    </td>
    <td width="62%">
    <input type="text" name="txtMLS" maxlength="2" value="<%=(rsInsert.Fields.Item("MLSArea").Value)%>" size="10">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Year Built</div>
    </td>
    <td width="62%">
    <p>
    <input type="text" name="txtYear" value="<%=(rsInsert.Fields.Item("YearBuilt").Value)%>" size="10" maxlength="4">
    </p>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Description <font size="1"><br>
    (no more than 250 characters)</font></div>
    </td>
    <td width="62%">
    <textarea name="txtDescrip" cols="50"></textarea>
    </td>
    </tr>
    </table>
    <br>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="20%">
    <div align="right">Lot Size</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtLot" value="<%=(rsInsert.Fields.Item("LotSize").Value)%>" size="10" maxlength="10">
    </div>
    </td>
    <td width="30%">
    <div align="right">Heated Square Footage</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtSqFt" value="<%=(rsInsert.Fields.Item("HeatedSquareFeet").Value)%>" size="10" maxlength="6">
    </div>
    </td>
    <td width="20%">
    <div align="right">Floors</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtFloors" maxlength="2" size="10" value="<%=(rsInsert.Fields.Item("Floors").Value)%>">
    </div>
    </td>
    </tr>
    </table>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="20%">
    <div align="right">Bedrooms</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtBed" size="10" maxlength="2" value="<%=(rsInsert.Fields.Item("Bedrooms").Value)%>">
    </div>
    </td>
    <td width="30%">
    <div align="right">Bathrooms</div>
    </td>
    <td width="10%">
    <input type="text" name="txtBath" size="10" maxlength="2" value="<%=(rsInsert.Fields.Item("Bathrooms").Value)%>">
    </td>
    <td width="20%">
    <div align="right">Total Rooms</div>
    </td>
    <td width="10%">
    <input type="text" name="txtRooms" size="10" maxlength="2" value="<%=(rsInsert.Fields.Item("Rooms").Value)%>">
    </td>
    </tr>
    </table>
    <h3 align="center">Property Type</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td>
    <div align="right">Commercial</div>
    </td>
    <td>
    <div align="left">
    <input type="radio" name="optCommercial" value="<%=(rsInsert.Fields.Item("Commercial").Value)%>">
    </div>
    </td>
    <td>
    <div align="right">Condo</div>
    </td>
    <td>
    <div align="left">
    <input type="radio" name="optCondo" value="<%=(rsInsert.Fields.Item("Condo").Value)%>">
    </div>
    </td>
    <td>
    <div align="right">Duplex</div>
    </td>
    <td>
    <div align="left">
    <input type="radio" name="optDuplex" value="<%=(rsInsert.Fields.Item("Duplex").Value)%>">
    </div>
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Farm</div>
    </td>
    <td>
    <input type="radio" name="optFarm" value="<%=(rsInsert.Fields.Item("Farm").Value)%>">
    </td>
    <td>
    <div align="right">Farm Ranch</div>
    </td>
    <td>
    <input type="radio" name="optFarmRanch" value="radiobutton">
    </td>
    <td>
    <div align="right">Houseboat</div>
    </td>
    <td>
    <input type="radio" name="optHouseboat" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Land</div>
    </td>
    <td>
    <input type="radio" name="optLand" value="radiobutton">
    </td>
    <td>
    <div align="right">Mobile Home</div>
    </td>
    <td>
    <input type="radio" name="optMobileHome" value="radiobutton">
    </td>
    <td>
    <div align="right">MultiFamily</div>
    </td>
    <td>
    <input type="radio" name="optMultiFamily" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Single Family</div>
    </td>
    <td>
    <input type="radio" name="optSingleFamily" value="radiobutton">
    </td>
    <td>
    <div align="right">Townhouse</div>
    </td>
    <td>
    <input type="radio" name="optTH" value="radiobutton">
    </td>
    <td>
    <div align="right"></div>
    </td>
    <td>&nbsp;</td>
    </tr>
    </table>
    <h3 align="center">Property Status</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="25%">
    <div align="right">Commercial</div>
    </td>
    <td width="10%">
    <input type="radio" name="optCommercialStatus" value="radiobutton">
    </td>
    <td width="25%">
    <div align="right">For Rent</div>
    </td>
    <td width="10%">
    <input type="radio" name="optForRent" value="radiobutton">
    </td>
    <td width="21%">
    <div align="right">For Sale</div>
    </td>
    <td width="9%">
    <input type="radio" name="optForSale" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td width="25%">
    <div align="right">Foreclosure</div>
    </td>
    <td width="10%">
    <input type="radio" name="optForeclosure" value="radiobutton">
    </td>
    <td width="25%">
    <div align="right">Land For Sale</div>
    </td>
    <td width="10%">
    <input type="radio" name="optLandForSale" value="radiobutton">
    </td>
    <td width="21%">
    <div align="right">Lot For Sale</div>
    </td>
    <td width="9%">
    <input type="radio" name="optLotForSale" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td width="25%">
    <div align="right">Sold</div>
    </td>
    <td width="10%">
    <input type="radio" name="optSold" value="radiobutton">
    </td>
    <td width="25%">
    <div align="right">Under Contract</div>
    </td>
    <td width="10%">
    <input type="radio" name="optUnderContract" value="radiobutton">
    </td>
    <td width="21%">
    <div align="right"></div>
    </td>
    <td width="9%">&nbsp;</td>
    </tr>
    </table>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="35%">
    <div align="right">Custom Status</div>
    </td>
    <td width="65%">
    <input type="text" name="txtCustomStatus" maxlength="30">
    </td>
    </tr>
    </table>
    <h3 align="center">Parking</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td>
    <div align="right">Attached Garage</div>
    </td>
    <td>
    <input type="radio" name="optAttGar" value="radiobutton">
    </td>
    <td>
    <div align="right">Detached Garage</div>
    </td>
    <td>
    <input type="radio" name="optDetGar" value="radiobutton">
    </td>
    <td>
    <div align="right">Carport</div>
    </td>
    <td>
    <input type="radio" name="optCarport" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Off Street</div>
    </td>
    <td>
    <input type="radio" name="optOffSt" value="radiobutton">
    </td>
    <td>
    <div align="right">On Street</div>
    </td>
    <td>
    <input type="radio" name="optOnSt" value="radiobutton">
    </td>
    <td>
    <div align="right"></div>
    </td>
    <td>&nbsp;</td>
    </tr>
    </table>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="38%">
    <div align="right">Number of Vehicles</div>
    </td>
    <td width="62%">
    <input type="text" name="txtNumCars" size="10" maxlength="2">
    </td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <h3 align="center">
    <input type="reset" name="Clear" value="Clear Everything, I need to start over!">
    </h3>
    <h3 align="center">
    <input type="submit" name="Submit" value="Add This Property">
    </h3>
    <p>
    <input type="hidden" name="MM_insert" value="true">
    </p>
    </form>
    </body>
    </html>
    <%
    rsInsert.Close()
    %>

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wanted to also say that I did my homework ... I have looked through the archives but I have not yet found another post relating to this error message.

  5. #5
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what line is the error on?

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The error is on line 90.

  7. #7
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this then

    <%@LANGUAGE="VBSCRIPT"%>
    <!--#include file="Connections/connProperties.asp" -->
    <%
    ' *** Edit Operations: declare variables

    MM_editAction = CStr(Request("URL"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Request.QueryString
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

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

    If (CStr(Request("MM_insert")) <> "") Then

    MM_editConnection = MM_connProperties_STRING
    MM_editTable = "PropertiesFull"
    MM_editRedirectUrl = "addsuccess.asp"
    MM_fieldsStr = "txtAdNum|value|txtPrice|value|txtDues|value|txtAddress|value|txtCity|value|mnuState|value|txtZip|value|txtCounty|value|txtNeighborhood|value|txtMLS|value|txtYear|value|txtDescrip|value|txtLot|value|txtSqFt|value|txtFloors|value|txtBed|value|txtBath|value|txtRooms|value|optCommercial|value|optCondo|value|optDuplex|value|optFarm|value|optFarmRanch|value|optHouseboat|value|optLand|value|optMobileHome|value|optMultiFamily|value|optSingleFamily|value|optTH|value|optCommercialStatus|value|optForRent|value|optForSale|value|optForeclosure|value|optLandForSale|value|optLotForSale|value|optSold|value|optUnderContract|value|txtCustomStatus|value|optAttGar|value|optDetGar|value|optCarport|value|optOffSt|value|optOnSt|value|txtNumCars|value"
    MM_columnsStr = "AdNum|none,none,NULL|Price|none,none,NULL|AssociationDues|none,none,NULL|Address|',none,''|City|',none,''|State|',none,''|Zip|',none,''|County|',none,''|Neighborhood|',none,''|MLSArea|none,none,NULL|YearBuilt|none,none,NULL|Description|',none,''|LotSize|',none,''|HeatedSquareFeet|none,none,NULL|Floors|none,none,NULL|Bedrooms|none,none,NULL|Bathrooms|none,none,NULL|Rooms|none,none,NULL|Commercial|none,'Y','N'|Condo|none,'Y','N'|Duplex|none,'Y','N'|Farm|none,'Y','N'|FarmRanch|none,'Y','N'|HouseBoat|none,'Y','N'|Land|none,'Y','N'|MobileHome|none,'Y','N'|Multifamily|none,'Y','N'|SingleFamily|none,'Y','N'|Townhouse|none,'Y','N'|CommercialStatus|none,'Y','N'|ForRent|none,'Y','N'|ForSale|none,'Y','N'|Foreclosure|none,'Y','N'|LandForSale|none,'Y','N'|LotForSale|none,'Y','N'|Sold|none,'Y','N'|UnderContract|none,'Y','N'|CustomStatus|',none,''|AttachedGarage|none,'Y','N'|DetachedGarage|none,'Y','N'|Carport|none,'Y','N'|OffStreet|none,'Y','N'|OnStreet|none,'Y','N'|Vehicles|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 i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(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

    ' *** Insert Record: construct a sql insert statement and execute it

    If (CStr(Request("MM_insert")) <> "") Then

    ' create the sql insert statement
    MM_tableValues = ""
    MM_dbValues = ""
    For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
    FormVal = EmptyVal
    Else
    If (AltVal <> "") Then
    FormVal = AltVal
    ElseIf (Delim = "'") Then ' escape quotes
    FormVal = "'" & Replace(FormVal,"'","''") & "'"
    Else
    FormVal = Delim + FormVal + Delim
    End If
    End If
    If (i <> LBound(MM_fields)) Then
    MM_tableValues = MM_tableValues & ","
    MM_dbValues = MM_dbValues & ","
    End if
    MM_tableValues = MM_tableValues & MM_columns(i)
    MM_dbValues = MM_dbValues & FormVal
    Next
    MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

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

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

    End If
    %>
    <%
    set rsInsert = Server.CreateObject("ADODB.Recordset")
    rsInsert.ActiveConnection = MM_connProperties_STRING
    rsInsert.Source = "SELECT * FROM PropertiesFull"
    rsInsert.CursorType = 0
    rsInsert.CursorLocation = 2
    rsInsert.LockType = 3
    rsInsert.Open()
    rsInsert_numRows = 0
    %>
    <html>
    <head>
    <title>Brett Knowles Real Estate - Add A New Property</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <form name="frmInsert" method="POST" action="<%=MM_editAction%>">
    <h2 align="center">Add A New Property</h2>
    <h3 align="center">Property Information</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="38%">
    <div align="right">Ad Number</div>
    </td>
    <td width="62%">
    <input type="text" name="txtAdNum" value="<%=(rsInsert.Fields.Item("AdNum").Value)%>">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Today's Date<br>
    <font size="1">month/day/four digit year.</font></div>
    </td>
    <td width="62%"> </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Price<br>
    <font size="1">Do not use $ sign, enter numbers only.</font> </div>
    </td>
    <td width="62%">
    <input type="text" name="txtPrice" value="<%=(rsInsert.Fields.Item("Price").Value)%>">
    <br>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Association Dues<br>
    <font size="1">Do not use $ sign, enter numbers only.</font> </div>
    </td>
    <td width="62%">
    <input type="text" name="txtDues" value="<%=(rsInsert.Fields.Item("AssociationDues").Value)%>">
    <br>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Address</div>
    </td>
    <td width="62%">
    <input type="text" name="txtAddress" value="<%=(rsInsert.Fields.Item("Address").Value)%>" size="24">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">City</div>
    </td>
    <td width="62%">
    <input type="text" name="txtCity" value="<%=(rsInsert.Fields.Item("City").Value)%>" size="24">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">State</div>
    </td>
    <td width="62%">
    <select name="mnuState">
    <option value="AK" selected>AK</option>
    <option value="AL">AL</option>
    <option value="AR">AR</option>
    <option value="AZ">AZ</option>
    <option value="CA">CA</option>
    <option value="CO">CO</option>
    <option value="CT">CT</option>
    <option value="DC">DC</option>
    <option value="DE">DE</option>
    <option value="FL">FL</option>
    <option value="GA">GA</option>
    <option value="HI">HI</option>
    <option value="IA">IA</option>
    <option value="ID">ID</option>
    <option value="IL">IL</option>
    <option value="IN">IN</option>
    <option value="KS">KS</option>
    <option value="KY">KY</option>
    <option value="LA">LA</option>
    <option value="MA">MA</option>
    <option value="MD">MD</option>
    <option value="ME">ME</option>
    <option value="MI">MI</option>
    <option value="MN">MN</option>
    <option value="MO">MO</option>
    <option value="MS">MS</option>
    <option value="MT">MT</option>
    <option value="NC">NC</option>
    <option value="ND">ND</option>
    <option value="NE">NE</option>
    <option value="NH">NH</option>
    <option value="NJ">NJ</option>
    <option value="NM">NM</option>
    <option value="NV">NV</option>
    <option value="NY">NY</option>
    <option value="OH">OH</option>
    <option value="OK">OK</option>
    <option value="OR">OR</option>
    <option value="PA">PA</option>
    <option value="RI">RI</option>
    <option value="SC">SC</option>
    <option value="SD">SD</option>
    <option value="TN">TN</option>
    <option value="TX">TX</option>
    <option value="UT">UT</option>
    <option value="VT">VT</option>
    <option value="VA">VA</option>
    <option value="WA">WA</option>
    <option value="WI">WI</option>
    <option value="WV">WV</option>
    <option value="WY">WY</option>
    <%
    While (NOT rsInsert.EOF)
    %>
    <option value="<%=(rsInsert.Fields.Item("State").Value)%>" ><%=(rsInsert.Fields.Item("State").Value)%></option>
    <%
    rsInsert.MoveNext()
    Wend
    If (rsInsert.CursorType > 0) Then
    rsInsert.MoveFirst
    Else
    rsInsert.Requery
    End If
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Zip</div>
    </td>
    <td width="62%">
    <input type="text" name="txtZip" value="<%=(rsInsert.Fields.Item("Zip").Value)%>" size="10">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">County</div>
    </td>
    <td width="62%">
    <input type="text" name="txtCounty" value="<%=(rsInsert.Fields.Item("County").Value)%>">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Neighborhood</div>
    </td>
    <td width="62%">
    <input type="text" name="txtNeighborhood" value="<%=(rsInsert.Fields.Item("Neighborhood").Value)%>">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">MLS Area</div>
    </td>
    <td width="62%">
    <input type="text" name="txtMLS" maxlength="2" value="<%=(rsInsert.Fields.Item("MLSArea").Value)%>" size="10">
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Year Built</div>
    </td>
    <td width="62%">
    <p>
    <input type="text" name="txtYear" value="<%=(rsInsert.Fields.Item("YearBuilt").Value)%>" size="10" maxlength="4">
    </p>
    </td>
    </tr>
    <tr>
    <td width="38%">
    <div align="right">Description <font size="1"><br>
    (no more than 250 characters)</font></div>
    </td>
    <td width="62%">
    <textarea name="txtDescrip" cols="50"></textarea>
    </td>
    </tr>
    </table>
    <br>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="20%">
    <div align="right">Lot Size</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtLot" value="<%=(rsInsert.Fields.Item("LotSize").Value)%>" size="10" maxlength="10">
    </div>
    </td>
    <td width="30%">
    <div align="right">Heated Square Footage</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtSqFt" value="<%=(rsInsert.Fields.Item("HeatedSquareFeet").Value)%>" size="10" maxlength="6">
    </div>
    </td>
    <td width="20%">
    <div align="right">Floors</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtFloors" maxlength="2" size="10" value="<%=(rsInsert.Fields.Item("Floors").Value)%>">
    </div>
    </td>
    </tr>
    </table>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="20%">
    <div align="right">Bedrooms</div>
    </td>
    <td width="10%">
    <div align="left">
    <input type="text" name="txtBed" size="10" maxlength="2" value="<%=(rsInsert.Fields.Item("Bedrooms").Value)%>">
    </div>
    </td>
    <td width="30%">
    <div align="right">Bathrooms</div>
    </td>
    <td width="10%">
    <input type="text" name="txtBath" size="10" maxlength="2" value="<%=(rsInsert.Fields.Item("Bathrooms").Value)%>">
    </td>
    <td width="20%">
    <div align="right">Total Rooms</div>
    </td>
    <td width="10%">
    <input type="text" name="txtRooms" size="10" maxlength="2" value="<%=(rsInsert.Fields.Item("Rooms").Value)%>">
    </td>
    </tr>
    </table>
    <h3 align="center">Property Type</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td>
    <div align="right">Commercial</div>
    </td>
    <td>
    <div align="left">
    <input type="radio" name="optCommercial" value="<%=(rsInsert.Fields.Item("Commercial").Value)%>">
    </div>
    </td>
    <td>
    <div align="right">Condo</div>
    </td>
    <td>
    <div align="left">
    <input type="radio" name="optCondo" value="<%=(rsInsert.Fields.Item("Condo").Value)%>">
    </div>
    </td>
    <td>
    <div align="right">Duplex</div>
    </td>
    <td>
    <div align="left">
    <input type="radio" name="optDuplex" value="<%=(rsInsert.Fields.Item("Duplex").Value)%>">
    </div>
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Farm</div>
    </td>
    <td>
    <input type="radio" name="optFarm" value="<%=(rsInsert.Fields.Item("Farm").Value)%>">
    </td>
    <td>
    <div align="right">Farm Ranch</div>
    </td>
    <td>
    <input type="radio" name="optFarmRanch" value="radiobutton">
    </td>
    <td>
    <div align="right">Houseboat</div>
    </td>
    <td>
    <input type="radio" name="optHouseboat" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Land</div>
    </td>
    <td>
    <input type="radio" name="optLand" value="radiobutton">
    </td>
    <td>
    <div align="right">Mobile Home</div>
    </td>
    <td>
    <input type="radio" name="optMobileHome" value="radiobutton">
    </td>
    <td>
    <div align="right">MultiFamily</div>
    </td>
    <td>
    <input type="radio" name="optMultiFamily" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Single Family</div>
    </td>
    <td>
    <input type="radio" name="optSingleFamily" value="radiobutton">
    </td>
    <td>
    <div align="right">Townhouse</div>
    </td>
    <td>
    <input type="radio" name="optTH" value="radiobutton">
    </td>
    <td>
    <div align="right"></div>
    </td>
    <td> </td>
    </tr>
    </table>
    <h3 align="center">Property Status</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="25%">
    <div align="right">Commercial</div>
    </td>
    <td width="10%">
    <input type="radio" name="optCommercialStatus" value="radiobutton">
    </td>
    <td width="25%">
    <div align="right">For Rent</div>
    </td>
    <td width="10%">
    <input type="radio" name="optForRent" value="radiobutton">
    </td>
    <td width="21%">
    <div align="right">For Sale</div>
    </td>
    <td width="9%">
    <input type="radio" name="optForSale" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td width="25%">
    <div align="right">Foreclosure</div>
    </td>
    <td width="10%">
    <input type="radio" name="optForeclosure" value="radiobutton">
    </td>
    <td width="25%">
    <div align="right">Land For Sale</div>
    </td>
    <td width="10%">
    <input type="radio" name="optLandForSale" value="radiobutton">
    </td>
    <td width="21%">
    <div align="right">Lot For Sale</div>
    </td>
    <td width="9%">
    <input type="radio" name="optLotForSale" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td width="25%">
    <div align="right">Sold</div>
    </td>
    <td width="10%">
    <input type="radio" name="optSold" value="radiobutton">
    </td>
    <td width="25%">
    <div align="right">Under Contract</div>
    </td>
    <td width="10%">
    <input type="radio" name="optUnderContract" value="radiobutton">
    </td>
    <td width="21%">
    <div align="right"></div>
    </td>
    <td width="9%"> </td>
    </tr>
    </table>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="35%">
    <div align="right">Custom Status</div>
    </td>
    <td width="65%">
    <input type="text" name="txtCustomStatus" maxlength="30">
    </td>
    </tr>
    </table>
    <h3 align="center">Parking</h3>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td>
    <div align="right">Attached Garage</div>
    </td>
    <td>
    <input type="radio" name="optAttGar" value="radiobutton">
    </td>
    <td>
    <div align="right">Detached Garage</div>
    </td>
    <td>
    <input type="radio" name="optDetGar" value="radiobutton">
    </td>
    <td>
    <div align="right">Carport</div>
    </td>
    <td>
    <input type="radio" name="optCarport" value="radiobutton">
    </td>
    </tr>
    <tr>
    <td>
    <div align="right">Off Street</div>
    </td>
    <td>
    <input type="radio" name="optOffSt" value="radiobutton">
    </td>
    <td>
    <div align="right">On Street</div>
    </td>
    <td>
    <input type="radio" name="optOnSt" value="radiobutton">
    </td>
    <td>
    <div align="right"></div>
    </td>
    <td> </td>
    </tr>
    </table>
    <table width="85%" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr>
    <td width="38%">
    <div align="right">Number of Vehicles</div>
    </td>
    <td width="62%">
    <input type="text" name="txtNumCars" size="10" maxlength="2">
    </td>
    </tr>
    </table>
    <p> </p>
    <h3 align="center">
    <input type="reset" name="Clear" value="Clear Everything, I need to start over!">
    </h3>
    <h3 align="center">
    <input type="submit" name="Submit" value="Add This Property">
    </h3>
    <p>
    <input type="hidden" name="MM_insert" value="true">
    </p>
    </form>
    </body>
    </html>
    <%
    rsInsert.Close()
    %>

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The error is now on line 89 ...

  9. #9
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I cant get my fecking head around this DWUD code, I'll have a look at it in more detail tonite.

    I'm not in the best frame of mind right now anyway

  10. #10
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know you and Goober advise hand-coding but this is a page I started a month ago and was one of the very first asp pages I ever built. Thank you for looking at it!

  11. #11
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Wilmington, NC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aha! I figured out the problem. Apparently, it is important to choose the proper radio button type depending on whether you're inserting to Access or another database. The type of radio button I chose was not the one for Access and so there was a "type mismatch". Thanks, 'D, for looking at the code this morning. Have a great night!


Bookmarks

Posting Permissions

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