微软VBScript编译错误:语句预计年底 [英] Microsoft VBScript compilation error: Expected end of statement

查看:433
本文介绍了微软VBScript编译错误:语句预计年底的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想插入一些记录到MS Access表中有以下VB脚本的帮助。但是,当我试图执行它,它抛出编译错误:语句的预期结束。可能有人请帮我找出我要去哪里错了。

 私人小组Form_Click()
昏暗的星展银行作为DAO.DATABASE
昏暗DbFullNAme作为字符串

DbFullName =D:\ G变\钻石\ FINAL MS-访问\ MS-访问project.accdb
设置DBS =的openDatabase(DbFullName)

dbs.ExecuteINSERT INTO [2014_Status](提示,项目名,状态,Release_Name)选择RoadMap.SPRF_CC,RoadMap.SPRF_Name,RoadMap.Project_Phase,RoadMap.Release_Name从路线图WHERE(((存在(选择1从[2014_Status]其中,路线图。.SPRF_CC = [2014_Status] [提示]))= FALSE));
dbs.Close
结束小组
 

解决方案

VBScript中(而不是VBA或其他方言)做的不可以支持类型变暗。因此,

 昏暗的星展银行作为DAO.DATABASE
昏暗DbFullNAme作为字符串
 

需要为

 暗淡DBS
昏暗的DbFullNAme
 

VBScript中没有本机的openDatabase()函数。您需要使用 ADO 连接到您的访问数据库。首先创建一个连接

 设置DBS =的CreateObject(ADODB.Connection)
 

然后确定连接字符串

  dbs.Open CS
 

你的code其余的应该工作。

更新WRT评论:

该错误消息:

  D:\ G变\钻石\ FINAL MS-访问\ query1.vbs(2,9)的Microsoft VBScript编译错误:语句预计年底
 

该三包凭证旧约试着写一个VBScript(加入误导VBA /访问标记的是(C)的Pankaj Jaju)。

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 statement. Could someone please help me figure out where am I going wrong.

Private Sub Form_Click()
Dim dbs         As DAO.Database
Dim DbFullNAme  As String

DbFullName = "D:\G\Diamond\FINAL MS-Access\MS-Access project.accdb"
Set dbs = OpenDatabase(DbFullName)

dbs.Execute "INSERT INTO [2014_Status] ( Prompt, Project_Name, STATUS,Release_Name )SELECT     RoadMap.SPRF_CC, RoadMap.SPRF_Name, RoadMap.Project_Phase,RoadMap.Release_Name FROM RoadMap WHERE (((Exists (select 1 FROM [2014_Status] where RoadMap.SPRF_CC = [2014_Status].[Prompt]))=False));"
dbs.Close
End Sub

解决方案

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).

这篇关于微软VBScript编译错误:语句预计年底的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆