Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple argument subs vba

Tags:

Using VBA with Access 2010, I have a sub:

Public Sub setInterest(account As String, dmonth As Integer)     ...somecode... End Sub 

And I am calling it with

setInterest("myAccount",3) 

And I get syntax errors.
Modifying the sub to only take one argument and leaving out the 3 gives no errors, the problem is only when I have 2 arguments.

like image 544
user1302398 Avatar asked Apr 14 '12 08:04

user1302398


1 Answers

When using multiple arguments, you can either write:

 setInterest "myAccount", 3 

Or

 Call setInterest("myAccount", 3) 

In both examples you can name the arguments:

setInterest account:="myAccount", dmonth:= 3 
like image 141
assylias Avatar answered Jan 10 '23 04:01

assylias