|
 |
access thread: ltrim in all records!
Message #1 by Rui Correia Monteiro <RCMONTEIRO@m...> on Fri, 22 Feb 2002 11:52:42 -0000
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1BB97.6F8382B0
Content-Type: text/plain
Hi !
I want to apply a LTRIM function to all records on all tables of a
database...
The problem is that there is a lot of tables, and each tables has a lot of
records...I'm searching for a method that can automate this...
Any sugestion?
Thanks is advance..
Paulo
Message #2 by "Gregory Serrano" <SerranoG@m...> on Fri, 22 Feb 2002 13:28:27
|
|
Rui,
<< I want to apply a LTRIM function to all records on all tables of a
database... The problem is that there is a lot of tables, and each tables
has a lot of records...I'm searching for a method that can automate
this... >>
I don't think there will be a fast and easy way of doing this. The best I
can come up with are update queries. You can specify all the fields in
the query and in the "Update To" boxes, you specify the same variable in
the LTRIM function. For example, if you want to change "Name" then create
an update query where in Design View:
Field: Name
Table: {Your Table}
Update To: LTRIM(Name)
Criteria: {leave the criteria blank}
Greg
Message #3 by brian.skelton@b... on Fri, 22 Feb 2002 16:32:43
|
|
Hi
You should be able to cycle through all your tables, open the the table
for editing, cycle through each record, then cycle through each field in
the record and then apply the LTRIM function!!
It'll be something like this:
Sub test()
Dim td As DAO.TableDef
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim fld As DAO.Field
Set db = CurrentDb
For Each td In db.TableDefs
'Check this isn't a system table
If Left$(td.Name, 4) <> "MSys" Then
Set rs = db.OpenRecordset(td.Name)
rs.MoveFirst
Do While Not (rs.EOF)
rs.Edit
For Each fld In rs.Fields
fld = LTrim(fld)
Next
rs.Update
Loop
rs.Close
End If
Next
End Sub
-Brian
> This message is in MIME format. Since your mail reader does not
understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01C1BB97.6F8382B0
> Content-Type: text/plain
>
> Hi !
>
> I want to apply a LTRIM function to all records on all tables of a
> database...
> The problem is that there is a lot of tables, and each tables has a lot
of
> records...I'm searching for a method that can automate this...
>
> Any sugestion?
>
> Thanks is advance..
>
> Paulo
>
>
> ------_=_NextPart_001_01C1BB97.6F8382B0
> Content-Type: text/html
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
> charset=3Dus-ascii">
> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version
> 5.5.2653.12">
> <TITLE>ltrim in all records!</TITLE>
> </HEAD>
> <BODY>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">Hi !</FONT>
> </P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">I want to apply a LTRIM function to
> all records on all tables of a database...</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">The problem is that there is a lot of
> tables, and each tables has a lot of records...I'm searching for a
> method that can automate this...</FONT></P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">Any sugestion?</FONT>
> </P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">Thanks is advance..</FONT>
> </P>
>
> <P><FONT SIZE=3D2
>
FACE=3D"Arial">Paulo<U><B></B></U></FONT><U><B></B></U><U><B>&l
t;/B></U>
> </P>
>
> </BODY>
> </HTML>
> ------_=_NextPart_001_01C1BB97.6F8382B0--
|
|
 |