如何在下面的代码中找到第13行字符35中的sytax错误 [英] How do I find the sytax error in line 13 character 35 in the code below

查看:108
本文介绍了如何在下面的代码中找到第13行字符35中的sytax错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

''''定义文件全名。 
strDBFullName =C:\ Users \ Charles \Documents \Weather \Weather.accdb

''''检查文件是否存在。
如果不是CreateObject(Scripting.FileSystemObject)。FileExists(strDBFullName)那么
MsgBoxFile& strDBFullName& 不存在或不可用。,vbCritical,找不到文件
WScript.Quit
结束如果

''''创建新的访问权限 - 实例,显示它并打开文件。
设置oAC = CreateObject(Access.Application)
oAC.Visible = True
设置oDB = oAC.OpenCurrentDataBase strDBFullName

'oDB.Run更新

''''打开并运行自动打开宏

''''保存工作簿并清理。
oDB.Save
oDB.Close
oAC.Quit
设置oAC = Nothing





我尝试了什么:



我已经尝试完全重新输入代码行,并在引号中输入文件路径和名称括弧。我找到的所有在线信息似乎都表明此代码有效

解决方案

第13行,第35个字符是:

设置oDB = oAC.OpenCurrentDataBase strDBFullName 
---------------------------------- ^



您几乎肯定需要将参数括在括号中:

设置oDB = oAC.OpenCurrentDataBase(strDBFullName)


'''' Define the file full name.
strDBFullName = "C:\Users\Charles\Documents\Weather\Weather.accdb"

'''' Check whether the file exists.
If Not CreateObject("Scripting.FileSystemObject").FileExists(strDBFullName) Then
  MsgBox "File """ & strDBFullName & """ does not exist or is not available.", vbCritical, "File Not Found"
  WScript.Quit
End If

'''' Create a new Access-instance, display it and open the file.
Set oAC = CreateObject("Access.Application")
oAC.Visible = True
Set oDB = oAC.OpenCurrentDataBase strDBFullName

'	oDB.Run "Update"

'''' Opens and Runs The Auto open Macro

'''' Save the workbook and clean up.
oDB.Save
oDB.Close
oAC.Quit
Set oAC = Nothing



What I have tried:

I have tried fully retyping the code line, and entering the the file path and name in quotes and parentheses. All the on line information I have found seems to suggest that this code is valid

解决方案

Line 13, character 35 is:

Set oDB = oAC.OpenCurrentDataBase strDBFullName
----------------------------------^


You almost certainly need to enclose the parameter in parentheses:

Set oDB = oAC.OpenCurrentDataBase(strDBFullName)


这篇关于如何在下面的代码中找到第13行字符35中的sytax错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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