Trim and UCase

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
 
D

DJ

-----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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top