Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Programmatic Find and Replace


Message #1 by "VERNON VINCENT" <VVINCENT@a...> on Wed, 30 Jan 2002 10:45:18 -0600
Is there a way to programmatically do a find and replace for specific 

words in a field.  For example, let's say I have a memo field filled with 

text and I want to replace all instances of "[TODAYS DATE]" with the 

actual date.



Thanks in advance



_________________________________________

Vernon L. Vincent

Programmer Analyst

Office of Illinois Attorney General Jim Ryan

vvincent@a...

(xxx) xxx-xxxx



Message #2 by "Leo Scott" <leoscott@c...> on Wed, 30 Jan 2002 09:02:05 -0800
If you are using Access 2000 or greater you can use the VBA Replace

function.



SomeString=Replace(StringtoSearch, "Some Value", "Another Value")



>-----Original Message-----

>From: VERNON VINCENT [mailto:VVINCENT@a...]

>Sent: Wednesday, January 30, 2002 8:45 AM

>To: Access

>Subject: [access] Programmatic Find and Replace

>

>

>Is there a way to programmatically do a find and replace for

>specific words in a field.  For example, let's say I have a memo

>field filled with text and I want to replace all instances of

>"[TODAYS DATE]" with the actual date.

>

>Thanks in advance

>

>_________________________________________

>Vernon L. Vincent

>Programmer Analyst

>Office of Illinois Attorney General Jim Ryan

>vvincent@a...

>(xxx) xxx-xxxx

>

>




>



Message #3 by "Randy Cornish" <rlcornish@c...> on Thu, 31 Jan 2002 14:50:29
To expand on what Leo suggested, you can include VBA and custom functions 

in your queries in Access.  This means that you can either use a built-in 

VBA function or create your own "Public" function (in a module) that does 

what you need.  Then, create an Update query and in the Update To cell 

for the field you want to change, type something like this:

   Replace([yourfieldname],"[TODAYS DATE]",CStr(Now))



R



> If you are using Access 2000 or greater you can use the VBA Replace

> function.

> 

> SomeString=Replace(StringtoSearch, "Some Value", "Another Value")

> 

> >

> >Is there a way to programmatically do a find and replace for

> >specific words in a field.  For example, let's say I have a memo

> >field filled with text and I want to replace all instances of

> >"[TODAYS DATE]" with the actual date.

> >


  Return to Index