Hi,
I'm trying to develop a recordselection formula in a VB program to search for all records with the string:
Fred's Bass Club
in a field called "club" within a table called "results"
The problem is that in this case, the string has an apostrophe in it.
I have tried the following code:
If InStr(1, cmbclub.Text, "'"
> 0 Then
inpos = InStr(1, cmbclub.Text, "'"
fmlatext = " left('" & inpos - 1 & "',{result.club}) = '" + Left(cmbclub.Text, inpos - 1) + "' and right('" & (Len(cmbclub.Text)) - inpos & "',{result.club}) = '" + Right(cmbclub.Text, (Len(cmbclub.Text)) - inpos) + "'"
Else
fmlatext = " {result.club} = '" & cmbclub.Text & "'"
End If
Which produces:
left('4',{result.club}) = 'Fred' and right('11',{result.club}) = 's Bass Club'"
This produces the error: "error in formula".
Any help would be greatly appreciated.
Thanks.
I'm trying to develop a recordselection formula in a VB program to search for all records with the string:
Fred's Bass Club
in a field called "club" within a table called "results"
The problem is that in this case, the string has an apostrophe in it.
I have tried the following code:
If InStr(1, cmbclub.Text, "'"
inpos = InStr(1, cmbclub.Text, "'"
fmlatext = " left('" & inpos - 1 & "',{result.club}) = '" + Left(cmbclub.Text, inpos - 1) + "' and right('" & (Len(cmbclub.Text)) - inpos & "',{result.club}) = '" + Right(cmbclub.Text, (Len(cmbclub.Text)) - inpos) + "'"
Else
fmlatext = " {result.club} = '" & cmbclub.Text & "'"
End If
Which produces:
left('4',{result.club}) = 'Fred' and right('11',{result.club}) = 's Bass Club'"
This produces the error: "error in formula".
Any help would be greatly appreciated.
Thanks.