Hi guys, i'm stumped... I have a form that inserts info into 3 tables. then it goes to a master list where you can edit the info. here's the code that inserts into the tables after the form is submitted.
<%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/html; charSet=iso-8859-1"
'--------------------------------------------------------------
'--- Module: SubmitPSS.asp
'---
'--- Version: 1.0
'---
'--- Purpose: This will take the values inputted on the PSS form,
'--- and insert them into the correct database tables.
'---
'--- Dependencies:
'---
'--- Notes:
'---
'--- Author: Gene Magerr genemagerr@hotmail.com
'--- Copyright 2001 Magerr Media all rights reserved
'--------------------------------------------------------------
%><!--#include file="../../adovbs.inc"--><%
'--------------------------------------------------------------
Dim cnTelmon, rsCust, rsSite, rsJob, rsOrderDetails
Dim strSQL, JobID, CustID, JobCode, SiteID
'--------------------------------------------------------------
'--- Declarations
'--------------------------------------------------------------
Set cnTelmon = Server.CreateObject("ADODB.Connection"
cnTelmon.Open "DSN=Telmon"
Set rsCust = Server.CreateObject("ADODB.Recordset"
rsCust.Open "Customers", cnTelmon, adOpenStatic, adLockOptimistic
rsCust.addnew
rsCust("CustCompanyName"
= Request.Form("custCompanyName"
rsCust("CustContactName"
= Request.Form("custContactName"
rsCust("CustContactTitle"
= Request.Form("custContactTitle"
rsCust("CustAddress"
= Request.Form("custAddress"
rsCust("CustCity"
= Request.Form("custCity"
rsCust("CustState"
= Request.Form("custState"
rsCust("CustZip"
= Request.Form("custZip"
rsCust("CustEmail"
= Request.Form("custEmail"
rsCust("CustPhone"
= Request.Form("custPhone"
rsCust.Update
rsCust.MoveLast
Session("CustomerID"
= rsCust("CustomerID"
CustID = Session("CustomerID"
rsCust.Close
Set rsCust = Nothing
Set rsSite = Server.CreateObject("ADODB.Recordset"
rsSite.Open "JobSite", cnTelmon, adOpenStatic, adLockOptimistic
rsSite.addnew
rsSite("SiteCustomerID"
= CustID
rsSite("SiteCompanyName"
= Request.Form("siteCompanyName"
rsSite("SiteContactName"
= Request.Form("siteContactName"
rsSite("SiteContactTitle"
= Request.Form("siteContactTitle"
rsSite("SiteAddress"
= Request.Form("siteAddress"
rsSite("SiteCity"
= Request.Form("siteCity"
rsSite("SiteState"
= Request.Form("siteState"
rsSite("SiteZip"
= Request.Form("siteZip"
rsSite("SiteEmail"
= Request.Form("siteEmail"
rsSite("SitePhone"
= Request.Form("sitePhone"
rsSite.Update
rsSite.MoveLast
Session("JobSiteID"
= rsSite("JobSiteID"
SiteID = Session("JobSiteID"
rsSite.Close
Set rsSite = Nothing
Set rsJob = Server.CreateObject("ADODB.Recordset"
rsJob.Open "Jobs", cnTelmon, adOpenStatic, adLockOptimistic
rsJob.AddNew
rsJob("JobSiteID"
= SiteID
rsJob("CustomerID"
= CustID
rsJob("JobCode"
= Request.Form("JobCode"
rsJob("PONumber"
= Request.Form("PONumber"
rsJob("OpenedBy"
= Request.Form("OpenedBy"
rsJob("LeadTech"
= Request.Form("LeadTech"
rsJob("CustomerQuoted"
= Request.Form("CustomerQuoted"
rsJob("EngineeredBy"
= Request.Form("EngineeredBy"
rsJob("TechSkillLevel"
= Request.Form("TechSkillLevel"
rsJob("TimeAndMaterial"
= Request.Form("TimeAndMaterial"
rsJob("BudgetedHours"
= Request.Form("BudgetedHours"
rsJob("ProjectManager"
= Request.Form("ProjectManager"
rsJob("PermitsNeeded"
= Request.Form("PermitsNeeded"
rsJob("UnionIssues"
= Request.Form("UnionIssues"
rsJob("ReqReceivedOn"
= Request.Form("ReqReceivedOn"
rsJob("ReqStart"
= Request.Form("ReqStart"
rsJob("ReqFinish"
= Request.Form("ReqFinish"
rsJob("RequiredStart"
= Request.Form("RequiredStart"
rsJob("RequiredFinish"
= Request.Form("RequiredFinish"
rsJob("NumOfLocs"
= Request.Form("NumOfLocs"
rsJob("PhoneSys"
= Request.Form("PhoneSys"
rsJob("InvoiceDate"
= Request.Form("InvoiceDate"
rsJob("Schedueled"
= Request.Form("Schedueled"
rsJob("FloorPlan"
= Request.Form("FloorPlan"
rsJob("Invoiced"
= Request.Form("Invoiced"
rsJob("Materials"
= Request.Form("Materials"
rsJob("JobStatus"
= Request.Form("JobStatus"
rsJob("ScopeOfWork"
= Request.Form("ScopeOfWork"
rsJob.Update
rsJob.MoveLast
Session("JobCode"
= rsJob("JobCode"
JobCode = Session("JobCode"
Session("JobID"
= rsJob.Fields.Item("JobID"
.Value
rsJob.Close
Set rsJob = Nothing
Set rsOrderDetails = Server.CreateObject("ADODB.Recordset"
rsOrderDetails.Open "OrderDetails", cnTelmon, adOpenStatic, adLockOptimistic
rsOrderDetails.AddNew
rsOrderDetails("JobCode"
= JobCode
rsOrderDetails.Update
rsOrderDetails.MoveLast
rsOrderDetails.Close
Set rsOrderDetails = Nothing
Response.Redirect "PSSMaster.asp"
'--------------------------------------------------------------
'--- Initialization
'--------------------------------------------------------------
'--------------------------------------------------------------
'--- Body
'--------------------------------------------------------------
'--------------------------------------------------------------
'--- Begin HTML output
'--------------------------------------------------------------
%>
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
<%
'----------------------------------------------------------------------
'--- End HTML Output
'----------------------------------------------------------------------
cnTelmon.Close
Set cnTelmon = Nothing
'----------------------------------------------------------------------
'--- All ASP post processing code goes here, as well as
'--- sub routines and functions
'----------------------------------------------------------------------
%>
I need to write an innerjoin statement that populates the form fields with the correct info from the corrisponding tables. For example, the jobs table info is pulled and placed in the text boxes ready to be edited, but the customer and jobsite info generates an error saying the data can't be found. So how would i join 3 tables together so all the data is relivant?
<%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/html; charSet=iso-8859-1"
'--------------------------------------------------------------
'--- Module: SubmitPSS.asp
'---
'--- Version: 1.0
'---
'--- Purpose: This will take the values inputted on the PSS form,
'--- and insert them into the correct database tables.
'---
'--- Dependencies:
'---
'--- Notes:
'---
'--- Author: Gene Magerr genemagerr@hotmail.com
'--- Copyright 2001 Magerr Media all rights reserved
'--------------------------------------------------------------
%><!--#include file="../../adovbs.inc"--><%
'--------------------------------------------------------------
Dim cnTelmon, rsCust, rsSite, rsJob, rsOrderDetails
Dim strSQL, JobID, CustID, JobCode, SiteID
'--------------------------------------------------------------
'--- Declarations
'--------------------------------------------------------------
Set cnTelmon = Server.CreateObject("ADODB.Connection"
cnTelmon.Open "DSN=Telmon"
Set rsCust = Server.CreateObject("ADODB.Recordset"
rsCust.Open "Customers", cnTelmon, adOpenStatic, adLockOptimistic
rsCust.addnew
rsCust("CustCompanyName"
rsCust("CustContactName"
rsCust("CustContactTitle"
rsCust("CustAddress"
rsCust("CustCity"
rsCust("CustState"
rsCust("CustZip"
rsCust("CustEmail"
rsCust("CustPhone"
rsCust.Update
rsCust.MoveLast
Session("CustomerID"
CustID = Session("CustomerID"
rsCust.Close
Set rsCust = Nothing
Set rsSite = Server.CreateObject("ADODB.Recordset"
rsSite.Open "JobSite", cnTelmon, adOpenStatic, adLockOptimistic
rsSite.addnew
rsSite("SiteCustomerID"
rsSite("SiteCompanyName"
rsSite("SiteContactName"
rsSite("SiteContactTitle"
rsSite("SiteAddress"
rsSite("SiteCity"
rsSite("SiteState"
rsSite("SiteZip"
rsSite("SiteEmail"
rsSite("SitePhone"
rsSite.Update
rsSite.MoveLast
Session("JobSiteID"
SiteID = Session("JobSiteID"
rsSite.Close
Set rsSite = Nothing
Set rsJob = Server.CreateObject("ADODB.Recordset"
rsJob.Open "Jobs", cnTelmon, adOpenStatic, adLockOptimistic
rsJob.AddNew
rsJob("JobSiteID"
rsJob("CustomerID"
rsJob("JobCode"
rsJob("PONumber"
rsJob("OpenedBy"
rsJob("LeadTech"
rsJob("CustomerQuoted"
rsJob("EngineeredBy"
rsJob("TechSkillLevel"
rsJob("TimeAndMaterial"
rsJob("BudgetedHours"
rsJob("ProjectManager"
rsJob("PermitsNeeded"
rsJob("UnionIssues"
rsJob("ReqReceivedOn"
rsJob("ReqStart"
rsJob("ReqFinish"
rsJob("RequiredStart"
rsJob("RequiredFinish"
rsJob("NumOfLocs"
rsJob("PhoneSys"
rsJob("InvoiceDate"
rsJob("Schedueled"
rsJob("FloorPlan"
rsJob("Invoiced"
rsJob("Materials"
rsJob("JobStatus"
rsJob("ScopeOfWork"
rsJob.Update
rsJob.MoveLast
Session("JobCode"
JobCode = Session("JobCode"
Session("JobID"
rsJob.Close
Set rsJob = Nothing
Set rsOrderDetails = Server.CreateObject("ADODB.Recordset"
rsOrderDetails.Open "OrderDetails", cnTelmon, adOpenStatic, adLockOptimistic
rsOrderDetails.AddNew
rsOrderDetails("JobCode"
rsOrderDetails.Update
rsOrderDetails.MoveLast
rsOrderDetails.Close
Set rsOrderDetails = Nothing
Response.Redirect "PSSMaster.asp"
'--------------------------------------------------------------
'--- Initialization
'--------------------------------------------------------------
'--------------------------------------------------------------
'--- Body
'--------------------------------------------------------------
'--------------------------------------------------------------
'--- Begin HTML output
'--------------------------------------------------------------
%>
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
<%
'----------------------------------------------------------------------
'--- End HTML Output
'----------------------------------------------------------------------
cnTelmon.Close
Set cnTelmon = Nothing
'----------------------------------------------------------------------
'--- All ASP post processing code goes here, as well as
'--- sub routines and functions
'----------------------------------------------------------------------
%>
I need to write an innerjoin statement that populates the form fields with the correct info from the corrisponding tables. For example, the jobs table info is pulled and placed in the text boxes ready to be edited, but the customer and jobsite info generates an error saying the data can't be found. So how would i join 3 tables together so all the data is relivant?