Question: I am trying to create a query which can give me a list of numbers in one field when I provide the range as Min and Max.
E.g Min = 30
Max = 35
Result: 30,31,32,33,34,35

The result should be in one field.

Farrukh Khan

Answer: 
I think the answer provided by Gustav, is a start. This is how it needs to be modified to get what you need.

First, create a VBA user defined function in a standard module. Like so,

```
Public Function ListOfNumbers(FirstValue As Long, LastValue As Long) As String
    Dim Index As Integer, tmpStr As String

    If LastValue < FirstValue Then
        ListOfNumbers = vbNullString
        Exit Function
    End If

    For Index = FirstValue To LastValue
        tmpStr = tmpStr & Index & ", "
    Next

    ListOfNumbers = Left(tmpStr, Len(tmpStr) - 2)
End Function

```

Remember the *Module name* ***should not*** be the same as the *Function name*. Then the SQL would be something like,

```
PARAMETERS 
    MinVal Long, 
    MaxVal Long;
SELECT 
    ListOfNumbers(MinVal, MaxVal);

```
You can use a function like this:

```
Public Function ListOfNumbers(ByVal FirstValue As Integer, ByVal LastValue As Integer) As String

    Dim NumberList()    As String
    Dim Index           As Integer

    ReDim NumberList(FirstValue To LastValue)

    For Index = FirstValue To LastValue
        NumberList(Index) = CStr(Index)
    Next

    ListOfNumbers = Join(NumberList, ",")

End Function

```