Escaping The Apostrophe

Опубликовано: 18 Июль 2026
на канале: Isladogs On Access
994
28

This video explains how to manage data containing apostrophes (such as last names O'Neill or De'ath) when writing VBA code in Access.
There are various solutions for fixing (escaping) the error.
The easiest solution is usually to replace the single quote (apostrophe) with two single quotes when running update or insert statements in VBA

The example database is available at https://isladogs.co.uk/dl/ApostropheF...

Times:
0:00 Intro
0:24 Example database with customer data
0:38 Apostrophes in last name e.g. O'Hagerty
1:20 Update query with apostrophe - no errors
2:00 Company record count
2:20 Bulk update query with apostrophe - again no errors
2:59 Problem comes when you use VBA code
3:11 Example VBA update code - no apostrophe
4:04 Example VBA update code - include apostrophe - error 3075
5:01 Replace single quote with two single quotes - code difficult to use
5:50 VBA update code using variables
6:55 Use of Replace function in VBA statement
7:25 Use Debug.Print to view in immediate window
8:00 A better method - Use variables in procedure header
9:05 Faster way of changing the variables
10:10 Summary - using values
10:30 Summary - using variables 1
11:27 Summary - using variables 2
11:50 Summary - using recordset
12:15 Thanks..please like/comment/subscribe...