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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql won't run, unspecifed error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Does anyone know what is wrong with this? I keep getting and unspecified error at the end.





data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
("\\cpweb2\fpdb\30pers.mdb")
sqlalignment = "SELECT dbo_t_EMPLOYEES.CurrentComp," &_
"dbo_t_EMPLOYEES.LAST_NAME, " &_
"dbo_t_EMPLOYEES.FIRST_NAME, " &_
"dbo_t_EMPLOYEES.STATUS, " &_
"dbo_t_EMPLOYEES.POSITION, " &_
"dbo_t_EMPLOYEES.PROGRAM, " &_
"dbo_t_GOVERNMENT.JOB_SERIES, " &_
"dbo_t_GOVERNMENT.GRADE, " &_
"Left([CurrentComp],3) AS Comp, " &_
"dbo_t_EMPLOYEES.EmployeeID, " &_
"[LAST_NAME]&', '&[FIRST_NAME] AS Name, " &_

"FROM dbo_t_EMPLOYEES JOIN dbo_t_GOVERNMENT ON dbo_t_EMPLOYEES.EmployeeID = dbo_t_GOVERNMENT.EmployeeID, " &_
"GROUP BY dbo_t_EMPLOYEES.CurrentComp, dbo_t_EMPLOYEES.LAST_NAME, dbo_t_EMPLOYEES.FIRST_NAME, " &_
"dbo_t_EMPLOYEES.STATUS, dbo_t_EMPLOYEES.POSITION, dbo_t_EMPLOYEES.PROGRAM, dbo_t_GOVERNMENT.JOB_SERIES, " &_
"dbo_t_GOVERNMENT.GRADE, Left([CurrentComp],3), dbo_t_EMPLOYEES.EmployeeID, [LAST_NAME]&', '&[FIRST_NAME], " &_
"HAVING (((dbo_t_EMPLOYEES.LAST_NAME) Not Like 'VAC%') AND , " &_
"((dbo_t_EMPLOYEES.STATUS) Like 'perman%' Or (dbo_t_EMPLOYEES.STATUS) Like '%term%')) , " &_
"OR (((dbo_t_EMPLOYEES.LAST_NAME) Not Like 'vac%') AND ((dbo_t_EMPLOYEES.STATUS) Like 'perman%', " &_
" Or (dbo_t_EMPLOYEES.STATUS) Like 'term%')), " &_
"ORDER BY dbo_t_EMPLOYEES.CurrentComp, dbo_t_EMPLOYEES.LAST_NAME "

Set rs = SERVER.CreateObject("ADODB.Recordset")
rs.Open sqlalignment, data_source
 
Try outputting the contents of sqlalignment (ie: response.write sqlalignment)then use that output to run the statement in access or whatever query engine you use to be sure the statement is correct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top