I am trying to create two records at the same time.
What I mean is, I need to give the hr department an opportunity to determine when an accident occurs, who is at fault.
So I created a screen that allows the hr dept to enter records about the employee involved in an accident and to also enter info about the police that responded to the accident.
The employee part is work but the police is not.
Please take a look and see if you can help me.
thanks in advance.
<%@ Language=VBScript%>
<%Response.buffer=true%>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
Set connectionToDatabase=Server.CreateObject("ADODB.Connection"
Set recordSet=Server.CreateObject("ADODB.Recordset"
connectionToDatabase.Open "DSN=aTrac;UID=janis;PWD=pass"
recordSet.Open "SELECT * FROM Driver",connectionToDatabase,1,3
Dim ss_nbr, fname, validate
validate=true
for each qryItem in Request.Form
if Request.Form(qryItem) = "" Then
validate = false
Response.Write("Missing : " & qryItem & "<BR>"
End if
next
if not validate then
Response.Write("<body bgcolor=steelblue><BR><font color=red><h3><b>" &_
"Please click the back button and complete the missing fields. " &_
"Thank You</b></h3></font></body> "
else
recordSet.AddNew
'recordSet("date"
= date()
'recordSet("time"
= Time()
recordSet("DriverID"
= Request.Form("SS_NUM"
recordSet("lname"
= Request.Form("LAST_NAME"
recordSet("fname"
= Request.Form("FIRST_NAME"
recordSet("MI"
= Request.Form("Middle_Initial"
recordSet("DriverGender"
= Request.Form("Driver_Sex"
recordSet("Address1"
= Request.Form("Address1"
recordSet("Address2"
= Request.Form("Address2"
recordSet("CityAdd"
= Request.Form("City"
recordSet("StateAdd"
= Request.Form("STATE"
recordSet("ZipAdd"
= Request.Form("ZIP_CODE"
recordSet("PhoneHome"
= Request.Form("Home_Phone"
recordSet("PhoneWork"
= Request.Form("Work_Phone"
recordSet("EmailAdd"
= Request.Form("Email_Address"
recordSet("Result"
= Request.Form("reason"
recordSet("InfluenceType"
= Request.Form("Influence_Type"
recordSet("InjuryType"
= Request.Form("Injury_Type"
recordSet.Update
recordSet.Open "SELECT * FROM Police",connectionToDatabase,1,3
recordSet.AddNew
'recordSet("date"
= date()
'recordSet("time"
= Time()
recordSet("PoliceID"
= Request.Form("code"
recordSet("offFname"
= Request.Form("offfname"
recordSet("offLname"
= Request.Form("offlname"
recordSet("accidentType"
= Request.Form("accident"
recordSet("accidentReport"
= Request.Form("remarks"
recordSet.Update
connectionToDatabase.Close
Set connectionToDatabase=Nothing
if Request.Form("CoApp"
= "NO" Then
Response.Redirect "co_applicant.asp?ss_nbr=" & Request.Form("SS_NUM"
else
Response.Redirect "new_applicant.asp"
end if
end if
end if
%>
</body>
</html>
What I mean is, I need to give the hr department an opportunity to determine when an accident occurs, who is at fault.
So I created a screen that allows the hr dept to enter records about the employee involved in an accident and to also enter info about the police that responded to the accident.
The employee part is work but the police is not.
Please take a look and see if you can help me.
thanks in advance.
<%@ Language=VBScript%>
<%Response.buffer=true%>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
Set connectionToDatabase=Server.CreateObject("ADODB.Connection"
Set recordSet=Server.CreateObject("ADODB.Recordset"
connectionToDatabase.Open "DSN=aTrac;UID=janis;PWD=pass"
recordSet.Open "SELECT * FROM Driver",connectionToDatabase,1,3
Dim ss_nbr, fname, validate
validate=true
for each qryItem in Request.Form
if Request.Form(qryItem) = "" Then
validate = false
Response.Write("Missing : " & qryItem & "<BR>"
End if
next
if not validate then
Response.Write("<body bgcolor=steelblue><BR><font color=red><h3><b>" &_
"Please click the back button and complete the missing fields. " &_
"Thank You</b></h3></font></body> "
else
recordSet.AddNew
'recordSet("date"
'recordSet("time"
recordSet("DriverID"
recordSet("lname"
recordSet("fname"
recordSet("MI"
recordSet("DriverGender"
recordSet("Address1"
recordSet("Address2"
recordSet("CityAdd"
recordSet("StateAdd"
recordSet("ZipAdd"
recordSet("PhoneHome"
recordSet("PhoneWork"
recordSet("EmailAdd"
recordSet("Result"
recordSet("InfluenceType"
recordSet("InjuryType"
recordSet.Update
recordSet.Open "SELECT * FROM Police",connectionToDatabase,1,3
recordSet.AddNew
'recordSet("date"
'recordSet("time"
recordSet("PoliceID"
recordSet("offFname"
recordSet("offLname"
recordSet("accidentType"
recordSet("accidentReport"
recordSet.Update
connectionToDatabase.Close
Set connectionToDatabase=Nothing
if Request.Form("CoApp"
Response.Redirect "co_applicant.asp?ss_nbr=" & Request.Form("SS_NUM"
else
Response.Redirect "new_applicant.asp"
end if
end if
end if
%>
</body>
</html>