By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,609 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,609 IT Pros & Developers. It's quick & easy.

Errors testing sample pages

P: 3
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:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body><%
  3. set conn=Server.CreateObject("ADODB.Connection")
  4. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  5. conn.Open "c:/inetpub/wwwroot/test/fpdb/mytest.mdb"
  6. set rs = Server.CreateObject("ADODB.recordset")
  7. rs.Open "SELECT Companyname, Contactname FROM Customers", connstr=rs.GetString(,,"</td><td>","</td></tr><tr><td>","&nbsp;")
  8. %><table border="1" width="100%">
  9.   <tr>
  10.     <td><%Response.Write(str)%></td>
  11.   </tr>
  12. </table><%
  13. rs.close
  14. conn.close
  15. set rs = Nothingset conn = Nothing%></body>
  16. </html>

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
May 16 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,923
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.
May 16 '07 #2

Expert 100+
P: 1,356
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.

Expand|Select|Wrap|Line Numbers
  1.     cst = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
  2.         "Data Source=" & Server.MapPath("/test/fpdb/mytest.mdb>") 
  4.     set conn = CreateObject("ADODB.Connection") 
  5. cst 

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.
May 17 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.