I have a button with embedded marco (using macro builder). The macro carries out a series of actions/command. One of actions is to call a vba function.
The intention is for this vba function to return a value back to the macro which will then carry a series of action based on the returned value.
However I have problem in achieving this. I have tried a number of ways but with no success. Below is one way I tried.
In the macro:
RunCode myFunction(myInt)
If myInt = 1 Then
RunMenuCommand .....
Else if myInt = 2 Then
RunMenuCommand .....
Else
RunMenuCommand....
End If
In the VBA function:
Public Function myFunction(myInt As Integer) As Integer
myFunction = .....
End Function
I know what I am asking is probably a simple question but as I am new the access I am still trying to learn the basic.
Any help and advice will be greatly appreciated. Thank you!
The intention is for this vba function to return a value back to the macro which will then carry a series of action based on the returned value.
However I have problem in achieving this. I have tried a number of ways but with no success. Below is one way I tried.
In the macro:
RunCode myFunction(myInt)
If myInt = 1 Then
RunMenuCommand .....
Else if myInt = 2 Then
RunMenuCommand .....
Else
RunMenuCommand....
End If
In the VBA function:
Public Function myFunction(myInt As Integer) As Integer
myFunction = .....
End Function
I know what I am asking is probably a simple question but as I am new the access I am still trying to learn the basic.
Any help and advice will be greatly appreciated. Thank you!
Last edited: