Johnny Wong said:
I would like to create a funtion that it can copy a table's data into a array or string. Then, I can use the string to do other thing. Assume the table contains only one column of data.
Thanks for any suggestion.
Yes, but how would you like that string to be displayed? And what would you like to do with it?
I did heavily edit this from some code I had, so sorry if there are any mistakes
DivString = Null 'The string that holds the text
Do While 1 = 1
'If the DivString is not empty, we check for strings NOT in the divstring
If IsNull(DivString) = False Then
GetText = DLookup("text", "table", "text not in (" & DivString & ")"
'If the DivString is empty, we check for the first string
Else
GetText = DLookup("text", "table")
End If
'If we cant find any(more) we exit
If IsNull(GetText) = True Then
Exit Do
End If
'Add the text to the string
DivString = DivString & " " & GetText
Loop