Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

short cut updating multiple

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

ResolvedVersion 2003

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.

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

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.