[AccessD] first caracter as Uppercase

DWUTKA at marlow.com DWUTKA at marlow.com
Thu Apr 22 17:32:46 CDT 2004


How's this?

Function SetAllDataToProperCase()
Dim tbldef As TableDef
Dim strSQL As String
Dim rs As Recordset
Dim i As Long
Dim FieldCheck As Boolean
For Each tbldef In CurrentDb.TableDefs
    If Left(tbldef.Name, 4) <> "MSys" Then
        'Set a boolean to make sure we have fields to actually update
        FieldCheck = False
        strSQL = "UPDATE " & tbldef.Name & " SET "
        Set rs = CurrentDb.OpenRecordset(tbldef.Name, dbOpenTable)
        For i = 0 To rs.Fields.Count - 1
            If rs.Fields(i).Type = 10 Or rs.Fields(i).Type = 12 Then
                'we have a valid field
                FieldCheck = True
                strSQL = strSQL & "[" & rs.Fields(i).Name & "]=StrConv([" &
rs.Fields(i).Name & "],3), "
            End If
        Next i
        If FieldCheck Then
            strSQL = Left(strSQL, Len(strSQL) - 2)
            CurrentDb.Execute strSQL
        End If
    End If
Next
MsgBox "Done"
End Function

That will change ALL text data in your database (text and memo fields)

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Pedro Janssen
Sent: Thursday, April 22, 2004 4:54 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] first caracter as Uppercase


Hello Drew,

how can i use this so that it sets all characters in all tables in a
database?

Pedro Janssen




----- Original Message -----
From: <DWUTKA at marlow.com>
To: <accessd at databaseadvisors.com>
Sent: Thursday, April 22, 2004 9:34 PM
Subject: RE: [AccessD] first caracter as Uppercase


> StrConv("this is a test",vbProperCase)
>
>
> results in:
>
>
> This Is A Test
>
> Drew
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Pedro Janssen
> Sent: Thursday, April 22, 2004 2:09 PM
> To: AccessD at databaseadvisors.com
> Subject: [AccessD] first caracter as Uppercase
>
>
> Hello Group,
>
> i have a code (thanks to Brett Barabash and Mark A Matte) that sets all
> characters in all tables to Lowercase.
>
> What i also would like to see is each character at the beginning of a word
> (each word that is separated by a space) is set to Uppercase in all Tables
> by just one code.
> Is this possible. Who can help me with this?
>
> TIA
>
> Pedro Janssen
> --
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> --
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list