I am using a simple lookup function to set the row source of a combo box based on the value set in another combo box.
This is working perfectly but I am getting a syntax error:
syntax error (missing operator) in query expression '[organisations].[governing body] = 'N'Land
This error only occurs when the selected value in box one contains an apostrophe!
I assume this is because the apostrophe effects the way VBA sees the string so it changes the search criteria?
This is the code being used:
Expand|Select|Wrap|Line Numbers
- varvalue = Me.Combo29.Column(1)
- row = "SELECT [name] FROM organisations WHERE [organisations].[governing body] = '" & varvalue & "'"
- Name1.RowSource = row
Thanks in advance
Carl
edit reply report