Returning a String in a Function

Joined
Sep 15, 2008
Messages
1
Reaction score
0
Hello All:

I'm sending a value from a query to the following function. The function is running properly based on checking it with breakpoints. However, the result does not show in my string (even though it is in the variable at the end).

Thanks,
Tony

Function GetSchoolsList(RefID As Integer) As Variant
Dim SchoolList As String
Dim rs As Recordset
Dim r As Integer

r = RefID

Set rs = CurrentDb.OpenRecordset("SELECT from qryUnavailSchoolsANDReferees WHERE [RefID] = " & r & " AND [Sportid] = 'FB';")

With rs
Do Until .EOF
SchoolList = SchoolList & ! & ","
.MoveNext
Loop
.Close
End With
SchoolList = Left(SchoolList, Len(SchoolList) - 1)
GetSchoolList = SchoolList
Set rs = Nothing

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top