Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access 运行时错误';5';:在使用全局变量时_Ms Access_Vba_Ms Access 2013 - Fatal编程技术网

Ms access 运行时错误';5';:在使用全局变量时

Ms access 运行时错误';5';:在使用全局变量时,ms-access,vba,ms-access-2013,Ms Access,Vba,Ms Access 2013,我在Module1中声明了全局变量,当我试图在另一个模块中使用它时,它显示了运行时错误“5”:\invalid procedure call或argument。我找不到问题,请提供此问题的解决方案 声明全局变量: Function getFilePath() As String getFilePath = FilePath Set FilePath = "C:\quadyster\R3AgreementDetails" End Function 全球变量的实施: Function getF

我在Module1中声明了全局变量,当我试图在另一个模块中使用它时,它显示了运行时错误“5”:\invalid procedure call或argument。我找不到问题,请提供此问题的解决方案 声明全局变量:

Function getFilePath() As String
 getFilePath = FilePath
 Set FilePath = "C:\quadyster\R3AgreementDetails"
End Function
全球变量的实施:

Function getFilePath() As String
 getFilePath = FilePath
 Set FilePath = "C:\quadyster\R3AgreementDetails"
End Function
Private Sub SendAgreement_Click()
 If (Not IsNull(Me.RequestFrom) And Not IsNull(Me.RequestReference)) Then
 Call AttachR3ServiceAgreement(Module1.FilePath, tripObjectFormation, "Agreement")
Me.AgreementDate = Now()

Else
 MsgBox "Please provide 'RequestFrom' and 'RequestReference' to proceed." & vbNewLine & vbNewLine & _
            "Press Ok to continue.", vbOKOnly, "Alert!!!"
End If
End Sub
这是调用函数

Public Function AttachR3ServiceAgreement(FilePath As String, tripData As 
  tripDetails, requestType As String)
出现以下错误:
Set objStream=objFSO.OpenTextFile(fileHTML,ForReading)

这里有一个语法错误:
Set
只能用于对象

Public FilePath As String
Function getFilePath() As String
  FilePath = "C:\quadyster\R3AgreementDetails"
  getFilePath = FilePath 
End Function

Private Sub SendAgreement_Click()
 If (Not IsNull(Me.RequestFrom) And Not IsNull(Me.RequestReference)) Then
 Call AttachR3ServiceAgreement(Module1.FilePath, tripObjectFormation, "Agreement")
Me.AgreementDate = Now()

Else
 MsgBox "Please provide 'RequestFrom' and 'RequestReference' to proceed." & vbNewLine & vbNewLine & _
            "Press Ok to continue.", vbOKOnly, "Alert!!!"
End If
End Sub

我在函数getFilePath()中初始化了全局变量的值,但在使用全局变量时,它显示为空字符串。如果是全局变量,为什么要将其作为参数传递给函数?或者,这是一个不同的变量,你正在使用作为一个全球性的-不是很清楚的问题描述