Is field name valid?
I wrote some export to DBF (yes, people still using DBF to exchange data!) routine today, and looked for some function to check that field name is valid. Have found nothing, so I wrote my own. Here it is, if you think something should be added – please write in comments:
Function IsValidFieldName(strFieldName As String) As Boolean
Dim i As Long
'first check that is does not start with number
IsValidFieldName = Not (strFieldName Like "#*")
For i = 1 To Len(strFieldName)
Select Case True 'then check for allowed chars
Case Mid(strFieldName, i, 1) Like "[a-z]"
Case Mid(strFieldName, i, 1) Like "[0-9]"
Case Mid(strFieldName, i, 1) Like "_"
'found something - not passed
IsValidFieldName = False