[AccessD] Trim in Access 2007

Michael R Mattys mmattys at rochester.rr.com
Fri Nov 30 09:13:46 CST 2007


Yes, that's what I had originally.
Trim() does not appear to work at all
I'll have to do it with a custom function like yours.

Michael R. Mattys
MapPoint & Access Dev
www.mattysconsulting.com

----- Original Message ----- 
From: "Gustav Brock" <Gustav at cactus.dk>
To: <accessd at databaseadvisors.com>
Sent: Friday, November 30, 2007 10:05 AM
Subject: Re: [AccessD] Trim in Access 2007


> Hi Michael
>
> Ignoring Trim for a moment, why not just execute a temporary query:
>
> Function TrimCass()
>
>    Dim oDB As DAO.Database
>    Dim oTbl As DAO.TableDef
>    Dim oQry As DAO.QueryDef
>    Dim oFld As DAO.Field
>
>    Dim strTmp As String
>    Dim strSql As String
>
>    Set oDB = CurrentDb
>    Set oQry = oDB.CreateQueryDef("", "SELECT * FROM CASS")
>    Set oTbl = oDB.TableDefs("CASS")
>
>    For Each oFld In oTbl.Fields
>        oQry.SQL = "UPDATE CASS SET CASS.[" & oFld.Name & "] = Trim([" & 
> oFld.Name & "])"
>        oQry.Execute
>    Next
>
>    Set oFld = Nothing
>    Set oTbl = Nothing
>    Set oQry = Nothing
>    Set oDB = Nothing
>
> End Function
>
> /gustav
>
>
> -- 
> 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