Hi everyone,
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:
Obviously the simple answer would be to go through and remove any apostrophes but this is not really the way I would like to resolve this if there is a better way!?
Thanks in advance
Carl
edit reply report
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:
Code:
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
Comment