short cut updating multiple

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

Short cut to updating multiple field properties | Access forum

resolvedResolved · Urgent Priority · Version 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.


 

Access tip:

Using the Quick Access Toolbar in Access 2010

The Quick Access Toolbar is included in virtually every Office product, including Outlook 2010, Word 2010, Excel 2010, and PowerPoint 2010.

You will find the Quick Access Toolbar in the top-left side of the window. To begin, click the Customize button (it's the little black arrow at the end of the toolbar).

Simply click the commands you want to include.

Virtually any command can be added to the Quick Access Toolbar. Click the More Commands option and a new window will open from where you can browse the commands including those not on the ribbon.

View all Access hints and tips


Server loaded in 0.07 secs.