Results 1 to 2 of 2

Thread: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause HELP!!!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    cape coral, fl, usa
    Posts
    7

    Post

    The point of this is to populate text box's after a selection from a drop down box is made...

    The code seems close but... there again... i am inexperienced...

    Please advise...
    Thanks

    PS
    For the love of GOD!!! Help!!!

    My error message is:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

    /888.asp, line 35


    My Code is:

    <%@ LANGUAGE="VBSCRIPT" %>
    <HTML>
    <HEAD>

    <%Manufacturer = Request.Form("Manufacturer")%>
    <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
    <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
    <TITLE>Visual InterDev &ltSELECT&gt Sample</TITLE>
    </HEAD>
    <BODY bgcolor="#FFFFFF">
    <p><font size="6"><strong>Auto Listing Page</strong></font></p>
    <p> </p>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT ID="DataCommand1" WIDTH=151 HEIGHT=24
    CLASSID="CLSID:7FAEED80-9D58-11CF-8F68-00AA006D27C2">
    <PARAM NAME="_Version" VALUE="65536">
    <PARAM NAME="_Version" VALUE="65536">
    <PARAM NAME="_ExtentX" VALUE="3986">
    <PARAM NAME="_ExtentY" VALUE="635">
    <PARAM NAME="_StockProps" VALUE="0">
    <PARAM NAME="DataConnection" VALUE="DataConn">
    <PARAM NAME="CommandText" VALUE="SELECT `Location` FROM CIEmpdir2">
    </OBJECT>
    -->
    <%
    Set DataConn = Server.CreateObject("ADODB.Connection")
    DataConn.ConnectionTimeout = Session("DataConn_ConnectionTimeout")
    DataConn.CommandTimeout = Session("DataConn_CommandTimeout")
    DataConn.Open "ASPBook", "sa", "yourpassword"
    Set cmdTemp = Server.CreateObject("ADODB.Command")
    Set DataCommand1 = Server.CreateObject("ADODB.Recordset")
    cmdTemp.CommandText = "SELECT `Locations` FROM CIEmpdir2"
    cmdTemp.CommandType = 1
    Set cmdTemp.ActiveConnection = DataConn
    DataCommand1.Open cmdTemp, , 0, 1
    %>
    <!--METADATA TYPE="DesignerControl" endspan-->
    <p>Select the manufacturer:</p>
    <FORM METHOD="POST" Action="888.asp" NAME="Form1">
    <SELECT LANGUAGE="JavaScript" ONCHANGE="Form1.submit()" SIZE=1 NAME="Manufacturer">

    <!-- Fill the <SELECT> list with values from the Manufacturers table -->
    <% Do While Not DATACommand1.EOF %>
    <%If Manufacturer = DataCommand1("Location") then%>
    <OPTION SELECTED>
    <%= DataCommand1("Location")%>
    </option>
    <%Else%>
    <OPTION>
    <%= DataCommand1("Location")%>
    </option>
    <%End if%>
    <% DataCommand1.MoveNext
    Loop %>

    </SELECT>
    </FORM>
    <%if Manufacturer = "" then Manufacturer = "HEADQUARTERS" %>
    <p><strong>Cars Offered by <%=Manufacturer%> :</strong></p>
    <table border="1">
    <tr>
    <td align="center"><strong>Location </strong></td>
    <td align="center"><strong>ID </strong></td>
    <td align="center"><strong>WPhone </strong></td>
    <td align="center"><strong>WFax </strong></td>
    <td align="center"><strong>MGREmail </strong></td>
    </tr>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT ID="DataCommand2" WIDTH=151 HEIGHT=24
    CLASSID="CLSID:7FAEED80-9D58-11CF-8F68-00AA006D27C2">
    <PARAM NAME="_Version" VALUE="65536">
    <PARAM NAME="_Version" VALUE="65536">
    <PARAM NAME="_ExtentX" VALUE="3986">
    <PARAM NAME="_ExtentY" VALUE="635">
    <PARAM NAME="_StockProps" VALUE="0">
    <PARAM NAME="DataConnection" VALUE="DataConn">
    <PARAM NAME="CommandText" VALUE="SELECT CIEmpdir2.`Location`, Stores.Store_ID, Stores.WPhone FROM Stores, CIEmpdir2 WHERE Stores.ID = CIEmpdir2.ID AND (CIEmpdir2.`Location` = '[Manufacturer]')">
    </OBJECT>
    -->
    <%
    Set DataConn = Server.CreateObject("ADODB.Connection")
    DataConn.ConnectionTimeout = Session("DataConn_ConnectionTimeout")
    DataConn.CommandTimeout = Session("DataConn_CommandTimeout")
    DataConn.Open "ASPBook", "sa", "yourpassword"
    Set cmdTemp = Server.CreateObject("ADODB.Command")
    Set DataCommand2 = Server.CreateObject("ADODB.Recordset")
    cmdTemp.CommandText = "SELECT CIEmpdir2.`Location`, Stores.Store_ID, Stores.WPhone FROM Stores, CIEmpdir2 WHERE Stores.ID = CIEmpdir2.ID AND (CIEmpdir2.`Location` = '" & Manufacturer & "')"
    cmdTemp.CommandType = 1
    Set cmdTemp.ActiveConnection = DataConn
    DataCommand2.Open cmdTemp, , 0, 1
    %>
    <!--METADATA TYPE="DesignerControl" endspan-->

    <% Do While Not DATACommand2.EOF %> <tr>
    <td><input type="text" name="Store_ID" size="20" value="<%= DataCommand2("Store_ID") %>"></td>
    <td><input type="text" name="WPhone" size="20" value="<%= DataCommand2("WPhone") %>"></td>
    <td><input type="text" name="WFax" size="20" value="<%= DataCommand2("WFax") %>"></td>
    <td><input type="text" name="MGREmail" size="20" value="<%= DataCommand2("MGREmail") %>"></td>
    </tr>
    <%
    DataCommand2.MoveNext
    Loop
    %>
    </table>
    </BODY>
    </html>

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    is there supposed to be an s on locations in line 32?

    if location is a field name why do you need `?

    cmdTemp.CommandText = "SELECT `Locations` FROM CIEmpdir2"

    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company


    [This message has been edited by Mark Sreeves (edited 01-26-2000).]

Posting Permissions

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



Click Here to Expand Forum to Full Width