1. Visual Basic/Access Basic - nothing special needs to be done to pass the parameter by reference, because this is the default in Visual Basic and Access.
Dim MyVar As Integer
MyVar = 1
Inc MyVar
MsgBox "Value now " & MyVar, 64, "Increment"
Sub Inc(IncRef As Variant)
IncRef = IncRef + 1
End Sub
2. FoxPro: the SET UDFPARMS command dictates whether parameters are passed by value or reference by default. The cleanest way by far is to set it to default to passing by value, and then explicitly pass by reference by prefixing with an at sign (@). This code is for Visual FoxPro.
Local lnMyVar
Set UDFParms To Value
lnMyVar = 1
= Increment(@lnMyVar)
= MessageBox("Value now " + AllTrim(Str(lnMyVar)), 64, "Increment")