Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL On Form

Status
Not open for further replies.

anon47

Programmer
Nov 28, 2006
80
US
I have the code be low that is giving me an error "The SELECT stament encludes a reserve word..." I am trying to get this code to pull a report on the employees and list them and there time to make it easy for accounting. HELP

SELECT DISTINCTROW Employees.SSN, Employees.Name AS Name Employees.PayRate AS PayRate Employees.TotalTime AS Time FROM Employees WHERE (((Employees.Inactive)=No) AND ((Employees.SSN) Is Not Null)) GROUP BY Employees.SSN;
 
What about this ?
SELECT DISTINCT SSN, [Name], PayRate, TotalTime AS [Time]
FROM Employees
WHERE Inactive = False AND SSN Is Not Null

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya anon47 . . .

See the errors in red:
Code:
[blue]SELECT DISTINCTROW Employees.SSN,  Employees.Name AS Name[COLOR=white red],[/color] Employees.PayRate AS PayRate Employees.TotalTime AS [COLOR=white red]Time[/color] FROM Employees WHERE (((Employees.Inactive)=No) AND ((Employees.SSN) Is Not Null)) GROUP BY Employees.SSN;[/blue]
Not a good idea using reserved words as with [COLOR=white red]Time[/color].

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
This would be one of those times when the error message is actually telling you exactly what's wrong.

 
Howdy JoeAtWork . . .

True that! . . . and if your not an experienced VBA programmer . . . then what!? . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Howdy JoeAtWork . . .

True that! . . . [blue]and if your not an experienced VBA programmer[/blue] . . . [purple]then what!?[/purple] . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top