Weird Error Message

A

Anthony

I keep getting this error:

ORDER BY clause ([ServiceYear]) conflicts with DISTINCT.


when this line tries to execute:

cboYear.RowSource = "SELECT DISTINCT [Service Year] FROM
ServiceDetails WHERE [ServiceCode] = 'ABC' ORDER BY [ServiceYear] DESC "


What am I doing wrong?
 
S

Stefan Hoffmann

hi Anthony,
I keep getting this error:
ORDER BY clause ([ServiceYear]) conflicts with DISTINCT.
when this line tries to execute:
cboYear.RowSource = "SELECT DISTINCT [Service Year] FROM
ServiceDetails WHERE [ServiceCode] = 'ABC' ORDER BY [ServiceYear] DESC "
What am I doing wrong?
Typo in the select list there is a space in the field name.


mfG
--> stefan <--
 
A

Anthony

No, that's not the problem because the field name has square brackets
([Field Name]) around it.

This, however, would be invalid:

(Field Name)

But this, would not:

([Field Name])
Stefan Hoffmann said:
hi Anthony,
I keep getting this error:
ORDER BY clause ([ServiceYear]) conflicts with DISTINCT.
when this line tries to execute:
cboYear.RowSource = "SELECT DISTINCT [Service Year] FROM
ServiceDetails WHERE [ServiceCode] = 'ABC' ORDER BY [ServiceYear] DESC "
What am I doing wrong?
Typo in the select list there is a space in the field name.


mfG
--> stefan <--
 
A

Anthony

oh, never mind - you are correct.
Stefan Hoffmann said:
hi Anthony,
I keep getting this error:
ORDER BY clause ([ServiceYear]) conflicts with DISTINCT.
when this line tries to execute:
cboYear.RowSource = "SELECT DISTINCT [Service Year] FROM
ServiceDetails WHERE [ServiceCode] = 'ABC' ORDER BY [ServiceYear] DESC "
What am I doing wrong?
Typo in the select list there is a space in the field name.


mfG
--> stefan <--
 
A

Anthony

thanks, Klatuu, that is correct
Klatuu said:
It appears to be a typo. You have it as [ServiceYear] in one place and
[Service Year] in another.
--
Dave Hargis, Microsoft Access MVP


Anthony said:
I keep getting this error:

ORDER BY clause ([ServiceYear]) conflicts with DISTINCT.


when this line tries to execute:

cboYear.RowSource = "SELECT DISTINCT [Service Year] FROM
ServiceDetails WHERE [ServiceCode] = 'ABC' ORDER BY [ServiceYear] DESC "


What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top