Is it possible to return 2 pieces of data from called Function?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to return two different values from a function when it is
called. My situation is this, I am building a record into a variable called
strWriteLine. I make a call to FD50, modify that record then return the
modified record. This works fine. What I would like to do is return with the
record a count of how many modifications were made. I keep track of this
number in Function FD50 but can it be returned to the calling Public Sub?

Following is the calling code and the Function called

strWriteLine = FD50(strLine, InvNum,)
Function FD50(strLine As String, InvNo As String)
---Modify the strWriteLine as strLine
End Function
 
hi Eddy,
Is it possible to return two different values from a function when it is
called.
Yes.

btw, use complete declarations.
Following is the calling code and the Function called

strWriteLine = FD50(strLine, InvNum,)
Function FD50(strLine As String, InvNo As String)
---Modify the strWriteLine as strLine
End Function

Option Compare Database
Option Explicit

Public Sub Test()

Dim strWriteLine As String
Dim strLine As String
Dim strInvNum As String
Dim lngCount As Long

lngCount = -1
strWriteLine = FD50(strLine, strInvNum, lngCount)
MsgBox lngCount

End Sub

Public Function FD50(ByVal strLine As String, _
ByVal InvNo As String, _
ByRef lngModifications As Long _
) As String

' Paste your code here.
' use lngModifications as counter.

lngModifications = 123

End Function


mfG
--> stefan <--
 
Back
Top