short cut updating multiple
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Short cut to updating multiple field properties

Short cut to updating multiple field properties

resolvedResolved · Urgent Priority · Version 2003

replyReply Wed 10 Sep 2008, 13:57Delegate Gillian said...

Gillian has attended:
Access VBA course
Excel Advanced course

Short cut to updating multiple field properties

Hi,

I am updating fields in a table recorset. Is there a quicker way to update multiple fields in a recordset in the same way e.g. Trim them all rather than code it individually for each field?
Conversely is there a quicker way to do lots of things to one (or many) field rather than code it individually e.g. for a field I want to trim it, do a few find and replaces, set to lower case etc?
Thanks.

For upcoming training course dates see: Pricing & availability

replyReply Wed 10 Sep 2008, 20:06Trainer Laura said...

RE: short cut to updating multiple field properties

Hi Gillian

If you need to tidy up every field in a similar way you could shorten your code and write a function to use on each field.

For Example

Function TidyUp(stOrigValue)
TidyUp = Trim(stOrigValue)
TidyUp = LCase(TidyUp)
End Function

and then when processing your fields

With rsMyTable
.fields("UserName")=TidyUp(.fields("UserName")
...

.Update
End With

Hope that helps

Laura

 

Please browse our web site to find out more about
ms+access+courses and other Microsoft training courses.

Access tip:

Random sampling

Data is th key to a good database, therefore checking is essential.

A good way of checking data is by random sampling. You can do this in a query, by typing the follow:
1) In the Field box create a RandonID field eg. Randon Id: Rnd(fieldname])

2) sort the field
3)Right click and chage the properties for To value to be the number of randon records you want to see.

4) Change the set to Show row for Randon ID to be False, add all the other fields you want to see and the run the query.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard