sorry I am too stressed out to find the thread I sent earlier today.
Here is what I am trying to do:
1, per my boss, we want to give our users to ability to do a search based on either firstname, lastname, posnumber, jobtitle, jobgrade, hiredate, and training and posNumber in one table must match posnumber in all other tables selected in the join.
The select and join parts, I believe are working.
However, in my whereclause, we want to give our users various textboxes to search to entire a search criteria.
For instance, search by posnumber------- search by lastname---- etc.
I am having problem with that.
We also want to say since a required course (courseType) has a yes or no answer, we want to say if the required course has been taken by an employee, automatically put a checkmark on that checkbox.
Here is what I have so.
It is not even close to doing what we want.
A kind help will be greatly appreciated.
GaryC123 started to help on this last night but I am completely off track due to beginner experience.
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>Search Results!</title>
</head>
<body bgcolor="steelBLUE">
<%
Dim SqlStmt
Set dbGlobalWeb = Server.CreateObject("ADODB.Connection"
dbGlobalWeb.Open "DSN=aTrac"
SqlStmt = "SELECT Training.TrainingID, Training.Courses," &_
"Training.CourseType, Training.PosNumber,Training.CourseStatus," &_
"Reason.Reasons,Personnell.LastName,Personnell.FirstName," &_
"Personnell.MiddleInitial,Personnell.HireDate,Personnell.JobTitle," &_
"Personnell.DeptAssignedTo,Personnell.JobGrade,Personnell.AcctFund " &_
"FROM Personnell, Training,AccountingFund,Grading,Reason "
If Request.Form("TypeSearch"
= "LastName " Then
SqlStmt = SqlStmt & " WHERE LastName LIKE '%" & Replace(strSearch, "'", "''"
& "%' " &_
Request.Form("DaInBox"
& "%'"
End If
If Request.Form("TypeSearch"
= "FirstName " Then
SqlStmt = SqlStmt & " WHERE FirstName LIKE '%" & Replace(strSearch, "'", "''"
& "%' " & _
Request.Form("DaInBox"
& "%'"
End If
If Request.Form("TypeSearch"
= "JobTitle " Then
SqlStmt = SqlStmt & " WHERE JobTitle LIKE '%" & Replace(strSearch, "'", "''"
& "%' " & _
Request.Form("DaInBox"
& "%'"
End If
If Request.Form("TypeSearch"
= "JobGrade " Then
SqlStmt = SqlStmt & " WHERE JobGrade LIKE '%" & Replace(strSearch, "'", "''"
& "%' " & _
Request.Form("DaInBox"
& "%'"
End If
If Request.Form("TypeSearch"
= "TrainingID " Then
SqlStmt = SqlStmt & " WHERE TrainingID LIKE '%" & Replace(strSearch, "'", "''"
& "%' " & _
Request.Form("DaInBox"
& "%'"
End If
If Request.Form("TypeSearch"
= "PosNumber " Then
SqlStmt = SqlStmt & " WHERE Personnell.PosNumber LIKE '%" & Replace(strSearch, "'", "''"
& "%' " &_
SqlStmt = SqlStmt & "AND Personnell.PosNumber = Training.PosNumber " &_
SqlStmt = SqlStmt & "AND Training.PosNumber = Reason.PosNumber " &_
SqlStmt = SqlStmt & "AND Reason.PosNumber = AccountingFund.PosNbr " &_
SqlStmt = SqlStmt & "AND AccountingFund.PosNbr = Grading.PosNbr " &_
Request.Form("DaInBox"
& "%'"
End If
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset"
rsGlobalWeb.Open SqlStmt, dbGlobalWeb, 3,3
%>
<% If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then %>
<h2 align="center">We did not find a match!</h2>
<%Else%>
<%If Not rsGlobalWeb.BOF Then%>
<h2>Here are the results of your search:</h2>
<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Last Name </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">First Name </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Middle Initial </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Position Number </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Job Title </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Job Grade </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Accounting Fund </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Hire Date </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Course Number </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Course Description </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Required? </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Course Status </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Reason Training Not Taken </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Dept Assigned To </font></th>
</tr>
<% Do While Not rsGlobalWeb.EOF %>
<tr>
<td><%=rsGlobalWeb("LastName"
%></td>
<td><%=rsGlobalWeb("FirstName"
%><td>
<td><%=rsGlobalWeb("MiddleInitial"
%><td>
<td><%=rsGlobalWeb("posNumber"
%><td>
<td><%=rsGlobalWeb("JobTitle"
%></td>
<td><%=rsGlobalWeb("JobGrade"
%></td>
<td><%=rsGlobalWeb("acctFund"
%></td>
<td><%=rsGlobalWeb("HireDate"
%></td>
<td><%=rsGlobalWeb("TrainingID"
%></td>
<td><%=rsGlobalWeb("Courses"
%></td>
<td><%=rsGlobalWeb("CourseType"
%></td>
<td><%=rsGlobalWeb("CourseStatus"
%></td>
<td><%=rsGlobalWeb("reasons"
%></td>
<td><%=rsGlobalWeb("DeptAssignedTo"
%></td>
</tr>
<%
rsGlobalWeb.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsGlobalWeb.Close
dbGlobalWeb.Close
%>
</body>
</html>
Here is what I am trying to do:
1, per my boss, we want to give our users to ability to do a search based on either firstname, lastname, posnumber, jobtitle, jobgrade, hiredate, and training and posNumber in one table must match posnumber in all other tables selected in the join.
The select and join parts, I believe are working.
However, in my whereclause, we want to give our users various textboxes to search to entire a search criteria.
For instance, search by posnumber------- search by lastname---- etc.
I am having problem with that.
We also want to say since a required course (courseType) has a yes or no answer, we want to say if the required course has been taken by an employee, automatically put a checkmark on that checkbox.
Here is what I have so.
It is not even close to doing what we want.
A kind help will be greatly appreciated.
GaryC123 started to help on this last night but I am completely off track due to beginner experience.
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>Search Results!</title>
</head>
<body bgcolor="steelBLUE">
<%
Dim SqlStmt
Set dbGlobalWeb = Server.CreateObject("ADODB.Connection"
dbGlobalWeb.Open "DSN=aTrac"
SqlStmt = "SELECT Training.TrainingID, Training.Courses," &_
"Training.CourseType, Training.PosNumber,Training.CourseStatus," &_
"Reason.Reasons,Personnell.LastName,Personnell.FirstName," &_
"Personnell.MiddleInitial,Personnell.HireDate,Personnell.JobTitle," &_
"Personnell.DeptAssignedTo,Personnell.JobGrade,Personnell.AcctFund " &_
"FROM Personnell, Training,AccountingFund,Grading,Reason "
If Request.Form("TypeSearch"
SqlStmt = SqlStmt & " WHERE LastName LIKE '%" & Replace(strSearch, "'", "''"
Request.Form("DaInBox"
End If
If Request.Form("TypeSearch"
SqlStmt = SqlStmt & " WHERE FirstName LIKE '%" & Replace(strSearch, "'", "''"
Request.Form("DaInBox"
End If
If Request.Form("TypeSearch"
SqlStmt = SqlStmt & " WHERE JobTitle LIKE '%" & Replace(strSearch, "'", "''"
Request.Form("DaInBox"
End If
If Request.Form("TypeSearch"
SqlStmt = SqlStmt & " WHERE JobGrade LIKE '%" & Replace(strSearch, "'", "''"
Request.Form("DaInBox"
End If
If Request.Form("TypeSearch"
SqlStmt = SqlStmt & " WHERE TrainingID LIKE '%" & Replace(strSearch, "'", "''"
Request.Form("DaInBox"
End If
If Request.Form("TypeSearch"
SqlStmt = SqlStmt & " WHERE Personnell.PosNumber LIKE '%" & Replace(strSearch, "'", "''"
SqlStmt = SqlStmt & "AND Personnell.PosNumber = Training.PosNumber " &_
SqlStmt = SqlStmt & "AND Training.PosNumber = Reason.PosNumber " &_
SqlStmt = SqlStmt & "AND Reason.PosNumber = AccountingFund.PosNbr " &_
SqlStmt = SqlStmt & "AND AccountingFund.PosNbr = Grading.PosNbr " &_
Request.Form("DaInBox"
End If
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset"
rsGlobalWeb.Open SqlStmt, dbGlobalWeb, 3,3
%>
<% If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then %>
<h2 align="center">We did not find a match!</h2>
<%Else%>
<%If Not rsGlobalWeb.BOF Then%>
<h2>Here are the results of your search:</h2>
<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Last Name </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">First Name </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Middle Initial </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Position Number </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Job Title </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Job Grade </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Accounting Fund </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Hire Date </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Course Number </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Course Description </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Required? </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Course Status </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Reason Training Not Taken </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Dept Assigned To </font></th>
</tr>
<% Do While Not rsGlobalWeb.EOF %>
<tr>
<td><%=rsGlobalWeb("LastName"
<td><%=rsGlobalWeb("FirstName"
<td><%=rsGlobalWeb("MiddleInitial"
<td><%=rsGlobalWeb("posNumber"
<td><%=rsGlobalWeb("JobTitle"
<td><%=rsGlobalWeb("JobGrade"
<td><%=rsGlobalWeb("acctFund"
<td><%=rsGlobalWeb("HireDate"
<td><%=rsGlobalWeb("TrainingID"
<td><%=rsGlobalWeb("Courses"
<td><%=rsGlobalWeb("CourseType"
<td><%=rsGlobalWeb("CourseStatus"
<td><%=rsGlobalWeb("reasons"
<td><%=rsGlobalWeb("DeptAssignedTo"
</tr>
<%
rsGlobalWeb.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsGlobalWeb.Close
dbGlobalWeb.Close
%>
</body>
</html>