property for small and big letters ?

Z

Zlatko Matiæ

What is the name of property that defines wheter a letter is big or small
(upper case, lower case) in VBA ?
 
K

KARL DEWEY

No property that I ever heard of but there are formating for display and
UCase and LCase that change the characters of the field.
UCase([YourField])
 
J

James A. Fortune

Zlatko said:
What is the name of property that defines wheter a letter is big or small
(upper case, lower case) in VBA ?

Use the Asc() function. Uppercase letters have ASCII values from 65 to
90. Lowercase letters have ASCII values from 97 to 122. To convert a
lowercase letter to an uppercase:

Chr(Asc("m") - 32) = "M"

James A. Fortune
 
K

Ken Sheridan

You can easily write a little function which returns True if upper case,
False if lower:

Function IsUpper(strChr As String) As Boolean

IsUpper = (StrComp(strChr, UCase(strChr), vbBinaryCompare) = 0)

End Function

So, IsUpper("M") returns True, IsUpper("m") returns False. Not alphabetic
characters always return True of course. If a string of more than one
character is passed into the function it will act on the complete string,
i.e. it will return True only if all alphabetic characters are upper case.
 
Z

Zlatko Matiæ

Hello,

Thank you guys for answer.

In fact, I want to change all my fields in all tables, linked tables,
queries and pass-through queries to lower case.
What would be the fastest way ?

Thanks in advance.
 
K

Ken Sheridan

You should be able to update the local and linked tables with some DAO which
loops throgh the Fields collection of each tabledef object and executes a
series of SQL statements. Be sure to back everything up first!

Dim dbs As DAO.Database, tdf As DAO.TableDef, fld As DAO.Field
Dim strSQL As String

Set dbs = CurrentDb

For Each tdf In dbs.TableDefs
If Left(tdf.Name, 4) <> "Msys" Then
For Each fld In tdf.Fields
strSQL = "UPDATE " & tdf.Name & _
" SET " & fld.Name & " = LCASE(" & _
fld.Name & ")"
On Error Resume Next
dbs.Execute strSQL
On Error GoTo 0
Next fld
End If
Next tdf
 
Z

Zlatko Matiæ

Hello, Ken!
Thank you for the code. I just added part for queries and successfuly done
it.

For Each qdf In dbs.QueryDefs
If Left(qdf.Name, 4) <> "Msys" Then
qdf.SQL = LCase(qdf.SQL)
End If
Next qdf

Thanks again,

Zlatko
 
Top