BlahBlahBlah
Registered User.
- Local time
- Today, 08:47
- Joined
- Sep 15, 2011
- Messages
- 17
Huh. I changed f to be a Variant and it worked fine:
Can anyone please tell me why this is?
Code:
Private Function getTableFieldNamesStr(tableName As String) As String
Dim fieldIdx As Integer
Dim f As [COLOR=Red][B]Variant[/B][/COLOR]
Dim fieldNamesStr As String
Dim fieldNames As Collection
Set fieldNames = getTableFieldNames(tableName)
fieldIdx = 1
For Each f In fieldNames
fieldNamesStr = fieldNamesStr & f
' Don't add comma to last field.
If fieldIdx < fieldNames.Count Then
fieldNamesStr = fieldNamesStr & ", "
End If
fieldIdx = fieldIdx + 1
Next
getTableFieldNamesStr = fieldNamesStr
End Function
Can anyone please tell me why this is?