To write a function with a variable number of parameters just make them optional. ie:
Public Function DoesSomething(Param1 as String, Optional Param2 as String = "Default", Optional Param3 as Integer = 100) as Sring
DoesSomething = Param1 & " " & Param2 & " " & Param3
end Function
Calling this in a routine would give you:
A) myField = DoesSomething("My String", "Another String", 50)
myField would = My String Another String 50
b) myField = DoesSomething("My String", "Another String"
myField would = My String Another String 100
c) myField = DoesSomething("My String"
myField would = My String Default 100
Make Sense? The optional ones must be the last parameters and you can supply them with a default value if they are not entered. All parameter rules apply.