THE WORLD'S LARGEST WEB DEVELOPER SITE

MS Access Replace() Function

❮ MS Access Functions

Example

Replace "i" with "a" in the string:

SELECT Replace("My name is Willy Wonka", "i", "a") AS ReplaceString;
Try it Yourself »

Definition and Usage

The Replace() function replaces a sequence of characters in a string with another set of characters (a number of times).

Syntax

Replace(string1, find, replacement, start, count, compare)

Parameter Values

Parameter Description
string1 Required. The string to replace a sequence of characters with another set of characters
find Required. The string that will be searched for in string1
replacement Required. The string to replace find in string1
start Optional. The position in string1 to begin the search. Position 1 is default
count Optional. The number of occurrences to replace. If omitted, the Replace() function will replace all occurrences of find with replacement
compare Optional. The type of comparison to perform.

Possible values:
-1: Uses option compare
0: Binary comparison
1: Textual comparison
2: Comparison based on your database

Technical Details

Works in: Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000

❮ MS Access Functions