I have several functions in my app which return arrays. Here is a clip of one that works:
'*************************************************************
Public Function GetCounts(pFullName As String, _
Optional pStartDate As Date, _
Optional pEndDate As Date) As Variant
.... bunch of code to calculate all those things....
GetCounts = Array(pFullName, pTotalOrders, pCountSales, pCountDoors, pCountGates, _
pCountWin, pCountSS, pCountSource, pTotalProducts)
rs.Close
Set rs = Nothing
End Function
'*************************************************************
So I tried a new function - maybe it's something stupid because I've been staring at it for quite a while, but I can't see a difference.
'*************************************************************
Public Function FindDups() As Variant
Dim rstLoopCust As ADODB.Recordset
Dim rstUpdateCust As ADODB.Recordset
Dim rec1 As Integer
Dim rec2 As Integer
rec1 = 0
rec2 = 0
........... bunch of code to find rec1 & rec2 ........
Debug.Print "customer #1 is: " & rec1
Debug.Print "customer #2 is: " & rec2
FindDups = Array(rec1, rec2)
End Function
'*************************************************************
Why do I get a "data type mistmatch '13'" on the second function? They're both defined at variants and both are using the "array" function to populate data.
Thanks for any help. I hate it when computers do what you tell them to and not what you mean!
/Wendy
'*************************************************************
Public Function GetCounts(pFullName As String, _
Optional pStartDate As Date, _
Optional pEndDate As Date) As Variant
.... bunch of code to calculate all those things....
GetCounts = Array(pFullName, pTotalOrders, pCountSales, pCountDoors, pCountGates, _
pCountWin, pCountSS, pCountSource, pTotalProducts)
rs.Close
Set rs = Nothing
End Function
'*************************************************************
So I tried a new function - maybe it's something stupid because I've been staring at it for quite a while, but I can't see a difference.
'*************************************************************
Public Function FindDups() As Variant
Dim rstLoopCust As ADODB.Recordset
Dim rstUpdateCust As ADODB.Recordset
Dim rec1 As Integer
Dim rec2 As Integer
rec1 = 0
rec2 = 0
........... bunch of code to find rec1 & rec2 ........
Debug.Print "customer #1 is: " & rec1
Debug.Print "customer #2 is: " & rec2
FindDups = Array(rec1, rec2)
End Function
'*************************************************************
Why do I get a "data type mistmatch '13'" on the second function? They're both defined at variants and both are using the "array" function to populate data.
Thanks for any help. I hate it when computers do what you tell them to and not what you mean!
/Wendy