Any help would be great. I'm trying to setup a filter for my address book program that uses an Access database. I have it working for a different form and I did it the same way as far as I know. For some reason though on this form I get the error "Syntax error: Missing operand after 'Name' operator." Here is the line of code that gives me the error:
Me.PhoneBindingSource.Filter = _
String.Format("{0} like '%{1}%'", _
Me.PIDSDataSet2.Phone.Last_NameColumn, _
Me.FilterTextBox.Text)

Syntax error: Missing operand after 'Name' operator.
SerenityNever
It sounds as though you may have changed one and not the other - so they got out of sync.
The database field and the dataset field are not dynamically linked together. If they are different then you have to be careful about which one you are using for SQL statements, Filter statements etc.
Dan-el
from the code example you provided
Me.PhoneBindingSource.Filter = _
String.Format("{0} like '%{1}%'", _
Me.PIDSDataSet2.Phone.Last_NameColumn, _
Me.FilterTextBox.Text)
If this is working on the other form then I would check that the current form your using this on has a Dataset called PIDSDataset2 which contains a Phone table with a Last_NameColumn field in it.
Normally the filter statement would be something like
'FieldName like '%foo%'"
In which case I would assume that Me.PIDSDataSet2.Phone.Last_NameColumn contains the name of the column which you are going to be doing the comparison on.
Have you checked that this actually contains anything.
Mike F
amadeus1eu
The field names can have spaces in them but it is generally not good practice as you then have to wrap the individual field names in [ ] to indicate the extent of the field names.
So from what you telling me you have a field called Last_NameColumn in the PIDSDataset.
Try the following line
Me.PhoneBindingSource.Filter = " Last_NameColumn like '%%'"
and see if this produces any records.
You look as though your providing it with a field - but the filter statement is simply trying to produce a filter SQL Statement and therefore you want to provide it with the field name and not the field.
If the above seems to work without error then try the following.
Me.PhoneBindingSource.Filter = _
String.Format("{0} like '%{1}%'", _
"Last_NameColumn", _
Me.FilterTextBox.Text)
S. Unal