Trim and UCase

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

Do Trim and UCase work the same way in VBA code that they
do in queries? I have the following, which is supposed to
upper case most of the fields in a record, but for some
reason it seems to just not do it. am i doing something
wrong??

'Open PIN table
Set tbl1 = db.OpenRecordset("New Awarded Items",
dbOpenDynaset)

'Upper case all items in PIN table except for unit price
and date
Do While Not tbl1.EOF
tbl1.Edit
UCase (tbl1(0))
UCase (tbl1(1))
UCase (tbl1(2))
UCase (tbl1(4))
UCase (tbl1(5))
UCase (tbl1(6))
UCase (tbl1(7))
UCase (tbl1(8))
tbl1.Update
tbl1.MoveNext
Loop

'Close old PIN table
tbl1.Close
 
-----Original Message-----
Do Trim and UCase work the same way in VBA code that they
do in queries? I have the following, which is supposed to
upper case most of the fields in a record, but for some
reason it seems to just not do it. am i doing something
wrong??

'Open PIN table
Set tbl1 = db.OpenRecordset("New Awarded Items",
dbOpenDynaset)

'Upper case all items in PIN table except for unit price
and date
Do While Not tbl1.EOF
tbl1.Edit
UCase (tbl1(0))
UCase (tbl1(1))
UCase (tbl1(2))
UCase (tbl1(4))
UCase (tbl1(5))
UCase (tbl1(6))
UCase (tbl1(7))
UCase (tbl1(8))
tbl1.Update
tbl1.MoveNext
Loop

'Close old PIN table
tbl1.Close

.
I think what you'll have to do is refer to each record in
the recordset, as such:

tbl1(0) = UCase(tbl(0))
and so on and so forth.

I usually use:
rst.Edit
rst!xxxx = UCase(rst!xxxx)
rst.Update
 
Back
Top