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!

Syntax Question - MS Access Qry -> VB ASP

Status
Not open for further replies.

CharlieMike73

Programmer
May 17, 2002
120
US
Can someone please help me convert this following MS Access SQL Query into a Query to be used on a VB-Script ASP page.

Or at least direct me to some program/site/tutorials that will help me.

I am trying to create the web page in Macromedia Dreamweaver MX, but get an error if I try to past the SQL from Access into the SQL Select statement.

Any help is appreciated!

Thank you,
Charlie

MS Access Code Below:
Code:
SELECT
   DBO_EMPLOYEE.LAST_NAME,
   DBO_EMPLOYEE.FIRST_NAME,
   Sum(DBO_WORK_REPORT_LABOR.REPORTED_HOURS)
     AS SumOfREPORTED_HOURS

FROM
   DBO_EMPLOYEE
     INNER JOIN (DBO_DAILY_WORK_REPORT INNER JOIN DBO_WORK_REPORT_LABOR
       ON DBO_DAILY_WORK_REPORT.DWR_SYS_ID = DBO_WORK_REPORT_LABOR.DWR_SYS_ID)
     ON DBO_EMPLOYEE.EMP_ID = DBO_WORK_REPORT_LABOR.EMP_ID

WHERE
   (((DBO_DAILY_WORK_REPORT.DWR_DATE)
     Between [Type Beginning Date:] And [Type Ending Date:])
   AND
   ((DBO_EMPLOYEE.UNIT_ID)>=5000
   And
   (DBO_EMPLOYEE.UNIT_ID)<6000))

GROUP BY
   DBO_EMPLOYEE.LAST_NAME,
   DBO_EMPLOYEE.FIRST_NAME,
   DBO_EMPLOYEE.EMP_ID
     HAVING
       (((Sum(DBO_WORK_REPORT_LABOR.REPORTED_HOURS))<40));
 
I'd use a stored procedure then there isn't much to cahnge at all
reference

---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
startDate = '12/12/2002'
endDate = '12/21/2002'

sql = &quot;SELECT &quot;&_
&quot;DBO_EMPLOYEE.LAST_NAME, &quot;&_
&quot;DBO_EMPLOYEE.FIRST_NAME, &quot;&_
&quot;Sum(DBO_WORK_REPORT_LABOR.REPORTED_HOURS) &quot;&_
&quot; AS SumOfREPORTED_HOURS &quot;&_
&quot;FROM &quot;&_
&quot;DBO_EMPLOYEE &quot;&_
&quot;INNER JOIN (DBO_DAILY_WORK_REPORT INNER JOIN DBO_WORK_REPORT_LABOR &quot;&_
&quot;ON DBO_DAILY_WORK_REPORT.DWR_SYS_ID = DBO_WORK_REPORT_LABOR.DWR_SYS_ID) &quot;&_
&quot;ON DBO_EMPLOYEE.EMP_ID = DBO_WORK_REPORT_LABOR.EMP_ID &quot;&_
&quot;WHERE &quot;&_
&quot;(((DBO_DAILY_WORK_REPORT.DWR_DATE) &quot;&_
&quot; Between '&quot; & startDate & &quot;' And '&quot; & endDate & &quot;') &quot;&_
&quot;AND &quot;&_
&quot;((DBO_EMPLOYEE.UNIT_ID)>=5000 &quot;&_
&quot;And &quot;&_
&quot;(DBO_EMPLOYEE.UNIT_ID)<6000)) &quot;&_
&quot;GROUP BY &quot;&_
&quot;DBO_EMPLOYEE.LAST_NAME, &quot;&_
&quot;DBO_EMPLOYEE.FIRST_NAME, &quot;&_
&quot;DBO_EMPLOYEE.EMP_ID &quot;&_
&quot;HAVING &quot;&_
&quot;(((Sum(DBO_WORK_REPORT_LABOR.REPORTED_HOURS))<40))&quot;
Get the Best Answers! faq333-2924
Happy 2003! [cheers]
mikewolf@tst-us.com
 
or that [lol] ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top