Errors testing sample pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DracoZA
    New Member
    • May 2007
    • 3

    Errors testing sample pages

    Hi there

    I wasnt sure if access was the right section to post but seeing as thats what im working on here goes.

    I spent some time on W3schools web however almost all of the samples I copied and pasted gave me the same/similair error:

    Microsoft VBScript compilation error '800a0401'
    Expected end of statement
    /test/demo_update.asp , line 15

    Sample Code:
    [CODE=VB]<html>
    <body><%
    set conn=Server.Cre ateObject("ADOD B.Connection")
    conn.Provider=" Microsoft.Jet.O LEDB.4.0"
    conn.Open "c:/inetpub/wwwroot/test/fpdb/mytest.mdb"
    set rs = Server.CreateOb ject("ADODB.rec ordset")
    rs.Open "SELECT Companyname, Contactname FROM Customers", connstr=rs.GetS tring(,,"</td><td>","</td></tr><tr><td>","& nbsp;")
    %><table border="1" width="100%">
    <tr>
    <td><%Response. Write(str)%></td>
    </tr>
    </table><%
    rs.close
    conn.close
    set rs = Nothingset conn = Nothing%></body>
    </html>[/CODE]



    Now seeing as these are samples I would assume they actually work, is there something happening on my 2003 Server or is there a language code difference that needs to be applied for using MS Access ?

    Many thanks
    Last edited by Denburt; May 17 '07, 07:36 PM. Reason: Code Tags
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    It sounds to me like you need to set a VB Library reference to Microsoft VB Script. Go into the VB code editor for the application. Select Tools > References from the Access command menu and look to see if it shows any references as being "Missing". If it does show a missing reference, then scroll down the alphabetical list; when you see the link referred to as missing, place a checkmark in the checkbox on the left and select ok.

    Hope this helps.

    Comment

    • Denburt
      Recognized Expert Top Contributor
      • Mar 2007
      • 1356

      #3
      Since it is a compilation error check for the missing references as dog suggested but also compile it. In the MS Access window go to the debug menu then click compile and see if you have any errors there.

      Next I saw the following statement and I don't see how this could work.

      conn.Open "c:/inetpub/wwwroot/test/fpdb/mytest.mdb"

      The statement "c:/inetpub/wwwroot/" tells me that it is in a web server folder and hopefully you are set up to run an asp page. If this is the case then your connection should look a little more like the following.

      [CODE=VB] cst = "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
      "Data Source=" & Server.MapPath( "/test/fpdb/mytest.mdb>")

      set conn = CreateObject("A DODB.Connection ")
      conn.open cst [/CODE]


      Originally posted by DracoZA
      Now seeing as these are samples I would assume they actually work

      Welcome to the real world, I would say about 95 percent of the samples you find on the net will have something left out. It won't always cause an error but with out it you will have sloppy coding practices. I used to get really frustrated when I didn't understand the concepts but I think most experienced programmers are willing to help but they want you to learn also. Most of my knowledge came from rooting around trying to fix the stupid error from the samples, helpfiles etc. I found out so much from doing it this way it really has helped me in the long run.

      Let us know how it goes.

      Comment

      Working...