Microsoft VBScript compilation error: Expected end of statement

前端 未结 3 1668
耶瑟儿~
耶瑟儿~ 2021-01-25 07:42

I am trying to insert some records into MS Access Table with the help of below VB Script. But when am trying to execute it, it\'s throwing Compilation error: Expected end of sta

3条回答
  •  臣服心动
    2021-01-25 08:24

    VBScript (as opposed to VBA or other dialects) does not support typed Dims. So

    Dim dbs         As DAO.Database
    Dim DbFullNAme  As String
    

    need to be

    Dim dbs
    Dim DbFullNAme
    

    VBscript has no native OpenDatabase() function. You need to use ADO to connect to your Access 'database'. First create a connection

    Set dbs = CreateObject("ADODB.Connection")
    

    Then determine the connection string and

    dbs.Open cs
    

    The rest of your code should work.

    Update wrt comment:

    The error message:

    D:\G\Diamond\FINAL MS-Access\query1.vbs(2, 9) Microsoft VBScript compilation error: Expected end of statement
    

    prooves that the OT tried to write a VBScript (the addition of the misleading vba/access tags is (C) Pankaj Jaju).

提交回复
热议问题