syntax error in query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I receive the following syntax error.....

Syntax error in date in query expression 'Group#'.

on the following SELECT query:

SELECT DISTINCT Group#, Count(Group#) AS GroupCount
FROM [Active EEs by Group#];
GROUP BY Group#

What I am trying to do is creat mail merge letters, and of course I only
want one letter for each instance of a group number. The query in the FROM
expression pulls all the active employees and sorts them by group number.

Am I missing quotes, parens, or brackets somewhere? I have tried
everything....
 
The syntax error is actually your second error. Your first error caused the
second.
Your first error is using # in a field name. Field names should contain
only letters, numbers and _ Not even a space. They should also not use any
words that are an access reserved word like Date, Type, etc.

The best thing you can do is replace Group# with something like Group_Num
every where you use it, including the field name.

The second best is to enclose it in brackets so Access knows it is a field
name.

SELECT DISTINCT [Group#], Count([Group#]) AS GroupCount
FROM [Active EEs by Group#];
GROUP BY Group#
 
Thanks so much for your quick response! That fixed it.

Being kind of new to Access (did you guess??) I was trying to keep
descriptions short and sweet - but I will definitely remember that for future
reference.

Again, I appreciate your help!

Klatuu said:
The syntax error is actually your second error. Your first error caused the
second.
Your first error is using # in a field name. Field names should contain
only letters, numbers and _ Not even a space. They should also not use any
words that are an access reserved word like Date, Type, etc.

The best thing you can do is replace Group# with something like Group_Num
every where you use it, including the field name.

The second best is to enclose it in brackets so Access knows it is a field
name.

SELECT DISTINCT [Group#], Count([Group#]) AS GroupCount
FROM [Active EEs by Group#];
GROUP BY Group#


Kerry said:
I receive the following syntax error.....

Syntax error in date in query expression 'Group#'.

on the following SELECT query:

SELECT DISTINCT Group#, Count(Group#) AS GroupCount
FROM [Active EEs by Group#];
GROUP BY Group#

What I am trying to do is creat mail merge letters, and of course I only
want one letter for each instance of a group number. The query in the FROM
expression pulls all the active employees and sorts them by group number.

Am I missing quotes, parens, or brackets somewhere? I have tried
everything....
 

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

Similar Threads


Back
Top