Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.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 VBA中的“按引用传递”不起作用_Ms Access_Vba - Fatal编程技术网

Ms access VBA中的“按引用传递”不起作用

Ms access VBA中的“按引用传递”不起作用,ms-access,vba,Ms Access,Vba,我想在access中测试按引用传递和按值传递,但它不起作用 Sub passByRef(ByRef a As Integer) a = a + 1 End Sub Sub passByVal(ByVal a As Integer) a = a + 1 End Sub Private Sub cmdByRef() Dim i as Integer i = 10 passByRef i MsgBox i End Sub Private Sub cmdByVal(

我想在access中测试按引用传递和按值传递,但它不起作用

Sub passByRef(ByRef a As Integer)
   a = a + 1
End Sub
Sub passByVal(ByVal a As Integer)
   a = a + 1
End Sub

Private Sub cmdByRef()
   Dim i as Integer
   i = 10
   passByRef i
   MsgBox i
End Sub
Private Sub cmdByVal()
   Dim i as Integer
   i = 10
   passByVal i
   MsgBox i
End Sub
在pass by ref中,它没有声明它是pass by REFEREF函数。有什么想法吗

maybe you should do this.

Private Sub cmdByRef()
   Dim i as Integer
   i = 10
   passByRef i
   MsgBox "Result of passByRef " + i
End Sub
Private Sub cmdByVal()
   Dim i as Integer
   i = 10
   passByVal i
   MsgBox "Result of passByVal " + i
End Sub