Results 1 to 5 of 5

Thread: Code Help from the wise one

  1. #1
    Ferguson Guest

    Code Help from the wise one

    Thanks for your help

    Here is my situation
    an MDB with a table with customer name, address, phone
    another table with work order details for customers such as name, when, where, etc

    First part of code drp dwn list of all customers in table

    select a name and click apply filter

    new screen with that customers name, address ect with the name being
    clickable

    HERE IS MY PROBLEM
    click name and it should search the second table for all occurances of that name. When I do that I get an error that says:

    Error # = -2147217900
    Description = [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (missing operator) in query expression 'Customer=Cazolas Pizza'.
    Source = Microsoft OLE DB Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    or another error that says

    Error # = -2147217900
    Description = [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (comma) in query expression 'Customer=Alpert, Robert'.
    Source = Microsoft OLE DB Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    The content of the Customer Name field could be Gates, Bill or a company namelike Microsoft.

    HERE IS A SAMPLE OF MY CODE:

    <% response.buffer=true %>
    <!--ASP-db-->
    <HTML>
    <HEAD><title>Work Order System</title>
    <Meta name=&#34;Meta Name&#34; Content=&#34;Meta Content&#34;>
    <Meta name=&#34;Author&#34; Content=&#34;Michael E. Ferguson Sr.,&#34;>
    </HEAD>

    <BODY BGCOLOR=&#34;lightblue&#34; TEXT=Black ALINK=&#34;red&#34; VLINK=&#34;blue&#34;>

    <FONT FACE=&#34;Arial,Helvetica&#34; COLOR=&#34;000000&#34; size=3>

    <CENTER><B><I>Welcome to the Work Order System</B></I><P>
    <B>Crafted & Maintained by Michael E. Ferguson, Sr.,</B>
    </CENTER>
    </FONT>
    <HR SIZE=5>
    <%
    Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34
    %>
    <%
    MyDb.dbDSN=&#34;dsnwosystem&#34;
    MyDb.DBColor = &#34;4&#34;
    MyDb.dbGridtabletag = &#34;border=8 cellspacing=3 cellpadding=3&#34;
    MyDb.DbMode = &#34;Grid&#34;
    MyDb.dbGridInc = 15
    Mydb.dbButtonAnchor=false
    Mydb.dbStartUp= &#34;Filter&#34;


    S = &#34;Select * from Customers&#34;
    MyDb.dbSQL = S

    &#39;Mydb.dbSelectBox = &#34;10,Pick a Driver,Click to Select; #Driver# &#34;

    MyDb.dbFilterFlds=&#34;Customer Name, heading=<P><B><I>Please choose which records you want to see</I></B>&#34;
    MyDb.dbFilterDropFlds = &#34;Customer Name,,Customers,Customer name; WO#,,WORKORDER,Work Order number&#34;
    Mydb.dbFilterParams =&#34;TableTag=Border=3, DropButtonText=none&#34;

    MyDb.DbGridInc=&#34;10&#34;

    MyDb.dbImageDir=&#34;images/&#34;
    Mydb.dbNavigation=&#34;top&#34;
    Mydb.dbNavigationItem=&#34;filter&#34;
    Mydb.dbNavigationIcon=&#34;std&#34;
    MyDb.dbUnit = 10113
    MyDb.dbMagicCell=&#34;1,,<A HREF=&#34;&#34;#me#?ID=#1#&#34;&#34;>#1#</a>&#34; &#39;** 05
    MyDb.ASPdbPRO
    RECS = Mydb.dbRecordCount
    %>
    <HR SIZE=5>
    </BODY>
    </HTML>

    <!--SECOND HALF OF CODE-->

    <%
    myvar=request(&#34;ID&#34 &#39;** 07
    if myvar<>&#34;&#34; then &#39;** 08
    %>
    <CENTER><h2>Database #2 - Work Order Details for #<%=myvar%></h2></CENTER>
    <%
    Set Y=Server.CreateObject(&#34;AspDB.Pro&#34 &#39;** 09
    Y.dbDSN=&#34;dsnwosystem&#34; &#39;** 10
    Y.dbmode=&#34;Grid&#34;
    Y.dbUnit=2 &#39;** 11
    Y.dbcolor=&#34;4,auto&#34;
    Y.dbGridTableTag=&#34;BORDER=1&#34;
    Y.dbNavigation=&#34;none&#34;
    Y.dbSQL=&#34;Select * FROM [WORKORDER] where Customer=&#34; & myvar & &#34; &#34; &#39;** 12
    Y.aspdbPRO &#39;** 13
    end if
    %>


  2. #2
    John Guest

    Code Help from the wise one (reply)

    Hi Ferguson,

    I think the problem may be in you use of &#34;#&#34; in a field name (WO#). That
    may be screwing things up.

    What you should do, is to turn debug mode on (dbDebug=true) and then copy
    and paste the SQL statement that&#39;s getting executed into an Access query
    (create a new query, choose View SQL and the paste it). Once you get the
    syntax to work there you&#39;re probably all set. If not, then check all your
    field names and make sure they don&#39;t contain any reserved words. Access is
    VERY sloppy about what it allows you to put in field names (#, ?, *, etc.)
    as was well as words like AND or FROM.

    Another approach to your problem might be to use the neat dbSelectBox
    feature! You could show all your customers (with address & phone if you wish)
    in a scrollable select box and then when the user clicks on one and clicks
    &#34;SELECT&#34; (or whatever you name the button), then it will &#34;drill down&#34; and
    show all the details for that record.

    Thanks and good luck!
    John

    On 12/22/98 6:57:49 AM, Ferguson wrote:
    > Thanks for your help

    Here is my situation
    an MDB with a table with
    > customer name, address, phone
    another table with work order details for
    > customers such as name, when, where, etc

    First part of code drp dwn list
    > of all customers in table

    select a name and click apply filter

    new
    > screen with that customers name, address ect with the name
    > being
    clickable

    HERE IS MY PROBLEM
    click name and it should search the
    > second table for all occurances of that name. When I do that I get an error
    > that says:

    Error # = -2147217900
    Description = [Microsoft][ODBC
    > Microsoft Access 97 Driver] Syntax error (missing operator) in query
    > expression &#39;Customer=Cazolas Pizza&#39;.
    Source = Microsoft OLE DB
    > Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    or
    > another error that says

    Error # = -2147217900
    Description =
    > [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (comma) in query
    > expression &#39;Customer=Alpert, Robert&#39;.
    Source = Microsoft OLE DB
    > Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    The
    > content of the Customer Name field could be Gates, Bill or a company
    > namelike Microsoft.

    HERE IS A SAMPLE OF MY CODE:

    <%
    > response.buffer=true %>
    <!--ASP-db-->
    <HTML>
    <HEAD><title>Work Order
    > System</title>
    <Meta name=&#34;Meta Name&#34; Content=&#34;Meta
    > Content&#34;>
    <Meta name=&#34;Author&#34; Content=&#34;Michael E. Ferguson
    > Sr.,&#34;>
    </HEAD>

    <BODY BGCOLOR=&#34;lightblue&#34; TEXT=Black
    > ALINK=&#34;red&#34; VLINK=&#34;blue&#34;>

    <FONT
    > FACE=&#34;Arial,Helvetica&#34; COLOR=&#34;000000&#34;
    > size=3>

    <CENTER><B><I>Welcome to the Work Order
    > System</B></I><P>
    <B>Crafted & Maintained by Michael E. Ferguson,
    > Sr.,</B>
    </CENTER>
    </FONT>
    <HR SIZE=5>
    <%
    Set MyDb =
    > Server.CreateObject(&#34;AspDB.Pro&#34
    %>
    <%
    MyDb.dbDSN=&#34;dsnwosyste
    > m&#34;
    MyDb.DBColor = &#34;4&#34;
    MyDb.dbGridtabletag = &#34;border=8
    > cellspacing=3 cellpadding=3&#34;
    MyDb.DbMode =
    > &#34;Grid&#34;
    MyDb.dbGridInc =
    > 15
    Mydb.dbButtonAnchor=false
    Mydb.dbStartUp= &#34;Filter&#34;


    S =
    > &#34;Select * from Customers&#34;
    MyDb.dbSQL = S

    &#39;Mydb.dbSelectBox
    > = &#34;10,Pick a Driver,Click to Select; #Driver#
    > &#34;

    MyDb.dbFilterFlds=&#34;Customer Name, heading=<P><B><I>Please
    > choose which records you want to see</I></B>&#34;
    MyDb.dbFilterDropFlds =
    > &#34;Customer Name,,Customers,Customer name; WO#,,WORKORDER,Work Order
    > number&#34;
    Mydb.dbFilterParams =&#34;TableTag=Border=3,
    > DropButtonText=none&#34;

    MyDb.DbGridInc=&#34;10&#34;

    MyDb.dbImageDir=&
    > #34;images/&#34;
    Mydb.dbNavigation=&#34;top&#34;
    Mydb.dbNavigationItem=
    > 4;filter&#34;
    Mydb.dbNavigationIcon=&#34;std&#34;
    MyDb.dbUnit =
    > 10113
    MyDb.dbMagicCell=&#34;1,,<A
    > HREF=&#34;&#34;#me#?ID=#1#&#34;&#34;>#1#</a>&#34; &#39;**
    > 05
    MyDb.ASPdbPRO
    RECS = Mydb.dbRecordCount
    %>
    <HR
    > SIZE=5>
    </BODY>
    </HTML>

    <!--SECOND HALF OF
    > CODE-->

    <%
    myvar=request(&#34;ID&#34 &#39;** 07
    if myvar<>&#34;&#34;
    > then &#39;** 08
    %>
    <CENTER><h2>Database #2 - Work Order Details for
    > #<%=myvar%></h2></CENTER>
    <%
    Set
    > Y=Server.CreateObject(&#34;AspDB.Pro&#34 &#39;**
    > 09
    Y.dbDSN=&#34;dsnwosystem&#34; &#39;**
    > 10
    Y.dbmode=&#34;Grid&#34;
    Y.dbUnit=2 &#39;**
    > 11
    Y.dbcolor=&#34;4,auto&#34;
    Y.dbGridTableTag=&#34;BORDER=1&#34;
    Y.dbNav
    > igation=&#34;none&#34;
    Y.dbSQL=&#34;Select * FROM [WORKORDER] where
    > Customer=&#34; & myvar & &#34; &#34; &#39;** 12
    Y.aspdbPRO &#39;** 13
    end if
    %>


  3. #3
    John Guest

    Code Help from the wise one (reply)

    P.S. Example B3 (http://www.aspdb.com/examples/aspdbexb03.asp) shows
    this dbSelectBox in action.

    John

  4. #4
    Frank Guest

    Code Help from the wise one (reply)

    &#34;#&#34; is the date wrapper of ACCESS - (e.g. #12/23/98#) . If you have a variable called #Var# you will be be able to get too far before you hit some kind of conflict.

    Frank


    On 12/22/98 1:29:38 PM, John wrote:
    > Hi Ferguson,

    I think the problem may be in you use of &#34;#&#34; in a
    > field name (WO#). That
    may be screwing things up.

    What you should do,
    > is to turn debug mode on (dbDebug=true) and then copy
    and paste the SQL
    > statement that&#39;s getting executed into an Access query
    (create a new
    > query, choose View SQL and the paste it). Once you get the
    syntax to work
    > there you&#39;re probably all set. If not, then check all your
    field
    > names and make sure they don&#39;t contain any reserved words. Access
    > is
    VERY sloppy about what it allows you to put in field names (#, ?, *,
    > etc.)
    as was well as words like AND or FROM.

    Another approach to your
    > problem might be to use the neat dbSelectBox
    feature! You could show all
    > your customers (with address & phone if you wish)
    in a scrollable select
    > box and then when the user clicks on one and clicks
    &#34;SELECT&#34; (or
    > whatever you name the button), then it will &#34;drill down&#34; and
    show
    > all the details for that record.

    Thanks and good luck!
    John

    On
    > 12/22/98 6:57:49 AM, Ferguson wrote:
    > Thanks for your help

    Here is my
    > situation
    an MDB with a table with
    > customer name, address,
    > phone
    another table with work order details for
    > customers such as
    > name, when, where, etc

    First part of code drp dwn list
    > of all
    > customers in table

    select a name and click apply filter

    new
    >
    > screen with that customers name, address ect with the name
    >
    > being
    clickable

    HERE IS MY PROBLEM
    click name and it should search the
    >
    > second table for all occurances of that name. When I do that I get an
    > error
    > that says:

    Error # = -2147217900
    Description =
    > [Microsoft][ODBC
    > Microsoft Access 97 Driver] Syntax error (missing
    > operator) in query
    > expression &#39;Customer=Cazolas Pizza&#39;.
    Source
    > = Microsoft OLE DB
    > Provider for ODBC Drivers
    SQL State =
    > 37000
    NativeError = -3100

    or
    > another error that says

    Error # =
    > -2147217900
    Description =
    > [Microsoft][ODBC Microsoft Access 97 Driver]
    > Syntax error (comma) in query
    > expression &#39;Customer=Alpert,
    > Robert&#39;.
    Source = Microsoft OLE DB
    > Provider for ODBC Drivers
    SQL
    > State = 37000
    NativeError = -3100

    The
    > content of the Customer Name
    > field could be Gates, Bill or a company
    > namelike Microsoft.

    HERE IS
    > A SAMPLE OF MY CODE:

    <%
    > response.buffer=true
    > %>
    <!--ASP-db-->
    <HTML>
    <HEAD><title>Work Order
    >
    > System</title>
    <Meta name=&#34;Meta Name&#34; Content=&#34;Meta
    >
    > Content&#34;>
    <Meta name=&#34;Author&#34; Content=&#34;Michael E. Ferguson
    >
    > Sr.,&#34;>
    </HEAD>

    <BODY BGCOLOR=&#34;lightblue&#34; TEXT=Black
    >
    > ALINK=&#34;red&#34; VLINK=&#34;blue&#34;>

    <FONT
    >
    > FACE=&#34;Arial,Helvetica&#34; COLOR=&#34;000000&#34;
    >
    > size=3>

    <CENTER><B><I>Welcome to the Work Order
    >
    > System</B></I><P>
    <B>Crafted & Maintained by Michael E. Ferguson,
    >
    > Sr.,</B>
    </CENTER>
    </FONT>
    <HR SIZE=5>
    <%
    Set MyDb =
    >
    > Server.CreateObject(&#34;AspDB.Pro&#34
    %>
    <%
    MyDb.dbDSN=&#34;dsnwosyste
    >
    > m&#34;
    MyDb.DBColor = &#34;4&#34;
    MyDb.dbGridtabletag = &#34;border=8
    >
    > cellspacing=3 cellpadding=3&#34;
    MyDb.DbMode =
    >
    > &#34;Grid&#34;
    MyDb.dbGridInc =
    >
    > 15
    Mydb.dbButtonAnchor=false
    Mydb.dbStartUp= &#34;Filter&#34;


    S =
    >
    > &#34;Select * from Customers&#34;
    MyDb.dbSQL =
    > S

    &#39;Mydb.dbSelectBox
    > = &#34;10,Pick a Driver,Click to Select;
    > #Driver#
    > &#34;

    MyDb.dbFilterFlds=&#34;Customer Name,
    > heading=<P><B><I>Please
    > choose which records you want to
    > see</I></B>&#34;
    MyDb.dbFilterDropFlds =
    > &#34;Customer
    > Name,,Customers,Customer name; WO#,,WORKORDER,Work Order
    >
    > number&#34;
    Mydb.dbFilterParams =&#34;TableTag=Border=3,
    >
    > DropButtonText=none&#34;

    MyDb.DbGridInc=&#34;10&#34;

    MyDb.dbImageDir=&
    >
    >
    > #34;images/&#34;
    Mydb.dbNavigation=&#34;top&#34;
    Mydb.dbNavigationItem=

    > > 4;filter&#34;
    Mydb.dbNavigationIcon=&#34;std&#34;
    MyDb.dbUnit =
    >
    > 10113
    MyDb.dbMagicCell=&#34;1,,<A
    >
    > HREF=&#34;&#34;#me#?ID=#1#&#34;&#34;>#1#</a>&#34; &#39;**
    >
    > 05
    MyDb.ASPdbPRO
    RECS = Mydb.dbRecordCount
    %>
    <HR
    >
    > SIZE=5>
    </BODY>
    </HTML>

    <!--SECOND HALF OF
    >
    > CODE-->

    <%
    myvar=request(&#34;ID&#34 &#39;** 07
    if myvar<>&#34;&#34;
    >
    > then &#39;** 08
    %>
    <CENTER><h2>Database #2 - Work Order Details for
    >
    > #<%=myvar%></h2></CENTER>
    <%
    Set
    >
    > Y=Server.CreateObject(&#34;AspDB.Pro&#34 &#39;**
    >
    > 09
    Y.dbDSN=&#34;dsnwosystem&#34; &#39;**
    >
    > 10
    Y.dbmode=&#34;Grid&#34;
    Y.dbUnit=2 &#39;**
    >
    > 11
    Y.dbcolor=&#34;4,auto&#34;
    Y.dbGridTableTag=&#34;BORDER=1&#34;
    Y.dbNav
    >
    > igation=&#34;none&#34;
    Y.dbSQL=&#34;Select * FROM [WORKORDER] where
    >
    > Customer=&#34; & myvar & &#34; &#34; &#39;** 12
    Y.aspdbPRO &#39;**
    > 13
    end if
    %>


  5. #5
    Ferguson Guest

    Code Help from the wise one (reply)

    Thank you guys. My problem is fixed. Preciate it
    On 12/22/98 6:57:49 AM, Ferguson wrote:
    > Thanks for your help

    Here is my situation
    an MDB with a table with
    > customer name, address, phone
    another table with work order details for
    > customers such as name, when, where, etc

    First part of code drp dwn list
    > of all customers in table

    select a name and click apply filter

    new
    > screen with that customers name, address ect with the name
    > being
    clickable

    HERE IS MY PROBLEM
    click name and it should search the
    > second table for all occurances of that name. When I do that I get an error
    > that says:

    Error # = -2147217900
    Description = [Microsoft][ODBC
    > Microsoft Access 97 Driver] Syntax error (missing operator) in query
    > expression &#39;Customer=Cazolas Pizza&#39;.
    Source = Microsoft OLE DB
    > Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    or
    > another error that says

    Error # = -2147217900
    Description =
    > [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (comma) in query
    > expression &#39;Customer=Alpert, Robert&#39;.
    Source = Microsoft OLE DB
    > Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    The
    > content of the Customer Name field could be Gates, Bill or a company
    > namelike Microsoft.

    HERE IS A SAMPLE OF MY CODE:

    <%
    > response.buffer=true %>
    <!--ASP-db-->
    <HTML>
    <HEAD><title>Work Order
    > System</title>
    <Meta name=&#34;Meta Name&#34; Content=&#34;Meta
    > Content&#34;>
    <Meta name=&#34;Author&#34; Content=&#34;Michael E. Ferguson
    > Sr.,&#34;>
    </HEAD>

    <BODY BGCOLOR=&#34;lightblue&#34; TEXT=Black
    > ALINK=&#34;red&#34; VLINK=&#34;blue&#34;>

    <FONT
    > FACE=&#34;Arial,Helvetica&#34; COLOR=&#34;000000&#34;
    > size=3>

    <CENTER><B><I>Welcome to the Work Order
    > System</B></I><P>
    <B>Crafted & Maintained by Michael E. Ferguson,
    > Sr.,</B>
    </CENTER>
    </FONT>
    <HR SIZE=5>
    <%
    Set MyDb =
    > Server.CreateObject(&#34;AspDB.Pro&#34
    %>
    <%
    MyDb.dbDSN=&#34;dsnwosyste
    > m&#34;
    MyDb.DBColor = &#34;4&#34;
    MyDb.dbGridtabletag = &#34;border=8
    > cellspacing=3 cellpadding=3&#34;
    MyDb.DbMode =
    > &#34;Grid&#34;
    MyDb.dbGridInc =
    > 15
    Mydb.dbButtonAnchor=false
    Mydb.dbStartUp= &#34;Filter&#34;


    S =
    > &#34;Select * from Customers&#34;
    MyDb.dbSQL = S

    &#39;Mydb.dbSelectBox
    > = &#34;10,Pick a Driver,Click to Select; #Driver#
    > &#34;

    MyDb.dbFilterFlds=&#34;Customer Name, heading=<P><B><I>Please
    > choose which records you want to see</I></B>&#34;
    MyDb.dbFilterDropFlds =
    > &#34;Customer Name,,Customers,Customer name; WO#,,WORKORDER,Work Order
    > number&#34;
    Mydb.dbFilterParams =&#34;TableTag=Border=3,
    > DropButtonText=none&#34;

    MyDb.DbGridInc=&#34;10&#34;

    MyDb.dbImageDir=&
    > #34;images/&#34;
    Mydb.dbNavigation=&#34;top&#34;
    Mydb.dbNavigationItem=&#3
    > 4;filter&#34;
    Mydb.dbNavigationIcon=&#34;std&#34;
    MyDb.dbUnit =
    > 10113
    MyDb.dbMagicCell=&#34;1,,<A
    > HREF=&#34;&#34;#me#?ID=#1#&#34;&#34;>#1#</a>&#34; &#39;**
    > 05
    MyDb.ASPdbPRO
    RECS = Mydb.dbRecordCount
    %>
    <HR
    > SIZE=5>
    </BODY>
    </HTML>

    <!--SECOND HALF OF
    > CODE-->

    <%
    myvar=request(&#34;ID&#34 &#39;** 07
    if myvar<>&#34;&#34;
    > then &#39;** 08
    %>
    <CENTER><h2>Database #2 - Work Order Details for
    > #<%=myvar%></h2></CENTER>
    <%
    Set
    > Y=Server.CreateObject(&#34;AspDB.Pro&#34 &#39;**
    > 09
    Y.dbDSN=&#34;dsnwosystem&#34; &#39;**
    > 10
    Y.dbmode=&#34;Grid&#34;
    Y.dbUnit=2 &#39;**
    > 11
    Y.dbcolor=&#34;4,auto&#34;
    Y.dbGridTableTag=&#34;BORDER=1&#34;
    Y.dbNav
    > igation=&#34;none&#34;
    Y.dbSQL=&#34;Select * FROM [WORKORDER] where
    > Customer=&#34; & myvar & &#34; &#34; &#39;** 12
    Y.aspdbPRO &#39;** 13
    end if
    %>


Posting Permissions

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