• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Can I insert and Increment?

I have a MS access/dreamweaver  application I am developing for entering Quality Readings.  My problem is that I need a way to input a set of readings and increment to next sample.  Like a dynamic table or any suggestions? Putting all of the input tables on one screen would be very cumbersome.  


Synopsis:

Operator Collects 6 samples and takes 5 readings from each

Enters Sample #1 and 5 Readings
            #2 and 5 Readings
            #3 and 5 Readings            
            #4 and 5 Readings
            #5 and 5 Readings
            #6 and 5 Readings

Solution:

I have created a form that supports the following attributes.

1.      Dynamic # of samples  (1-12)
2.      Dynamic # of readings per sample (1-20)

Access Database with control tables and sample tables

Form is designed to populate input fields from access db control file. (Description, id num, Date, time etc.)

Input pre-populated fields and readings to sample table in Access DB per item

Increment to next sample for input.

When out of sample  end


Please Help!

0
Pastian
Asked:
Pastian
  • 4
  • 3
  • 3
2 Solutions
 
rockmansatticCommented:
Why dont you just let DW 'redirect' to the same page.

when you setup the insert page, just put the same filename in the field

rockman
0
 
rockmansatticCommented:
Also, if you did setup using DW, then there should be a MM_logoutRedirectPage variable set near the top of the page in the code.

you can change this variable to the same page.

there are other more complicated ways of inputing multiple records, but sounds like this is the easisest for your application.


Rockman
0
 
PastianAuthor Commented:
Thanks Rockman!

I have trimmed this down considerably, but the gist here is once this form is submitted then I want the same form with a differnt carton number etc.. until I am out of sample.

something like this?

for i to <whatever the number of samples to take is>

display form with input fields

Next

Here is some code to describe this form:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/GPC.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_GPC_STRING
  MM_editTable = "SBSAMPLE"
  MM_editRedirectUrl = "sbprodselect.asp"
  MM_fieldsStr  = "proddesc|value|UCL|value|STAT_TGT|value|STAT_LCL|value|sampdate|value|samptime|value|Work_Order_Number|value|MACH|value|sbdienum|value|sbdcpos|value|OPERATOR|value|CARTnum|value|b1|value|s1|value|e1|value|b2|value|s2|value|e2|value|b3|value|s3|value|e3|value|b4|value|s4|value|e4|value|b5|value|s5|value|e5|value|b6|value|s6|value|e6|value|b7|value|s7|value|e7|value|b8|value|s8|value|e8|value|b9|value|s9|value|e9|value|b10|value|s10|value|e10|value|b11|value|s11|value|e11|value|b12|value|s12|value|e12|value|b13|value|s13|value|e13|value|b14|value|s14|value|e14|value|b15|value|s15|value|e15|value|b16|value|s16|value|e16|value|b17|value|s17|value|e17|value|b18|value|s18|value|e18|value|b19|value|s19|value|e19|value|b20|value|s20|value|e20|value|COMMENTS|value"
  MM_columnsStr = "prodesc|',none,''|sbucl|none,none,NULL|sbtgt|none,none,NULL|sblcl|none,none,NULL|sampdate|',none,NULL|samptime|',none,NULL|Work_Order_Number|',none,''|mach|',none,''|sbdienum|',none,''|sbdcpos|none,none,NULL|operator|',none,''|cnum|none,none,NULL|b1|none,none,NULL|s1|none,none,NULL|e1|none,none,NULL|b2|none,none,NULL|s2|none,none,NULL|e2|none,none,NULL|b3|none,none,NULL|s3|none,none,NULL|e3|none,none,NULL|b4|none,none,NULL|s4|none,none,NULL|e4|none,none,NULL|b5|none,none,NULL|s5|none,none,NULL|e5|none,none,NULL|b6|none,none,NULL|s6|none,none,NULL|e6|none,none,NULL|b7|none,none,NULL|s7|none,none,NULL|e7|none,none,NULL|b8|none,none,NULL|s8|none,none,NULL|e8|none,none,NULL|b9|none,none,NULL|s9|none,none,NULL|e9|none,none,NULL|b10|none,none,NULL|s10|none,none,NULL|e10|none,none,NULL|b11|none,none,NULL|s11|none,none,NULL|e11|none,none,NULL|b12|none,none,NULL|s12|none,none,NULL|e12|none,none,NULL|b13|none,none,NULL|s13|none,none,NULL|e13|none,none,NULL|b14|none,none,NULL|s14|none,none,NULL|e14|none,none,NULL|b15|none,none,NULL|s15|none,none,NULL|e15|none,none,NULL|b16|none,none,NULL|s16|none,none,NULL|e16|none,none,NULL|b17|none,none,NULL|s17|none,none,NULL|e17|none,none,NULL|b18|none,none,NULL|s18|none,none,NULL|e18|none,none,NULL|b19|none,none,NULL|s19|none,none,NULL|e19|none,none,NULL|b20|none,none,NULL|s20|none,none,NULL|e20|none,none,NULL|notes|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim operators
Dim operators_numRows

Set operators = Server.CreateObject("ADODB.Recordset")
operators.ActiveConnection = MM_GPC_STRING
operators.Source = "SELECT *  FROM WebOperators  ORDER BY OI ASC"
operators.CursorType = 0
operators.CursorLocation = 2
operators.LockType = 1
operators.Open()

operators_numRows = 0
%>
<%
Dim Machine
Dim Machine_numRows

Set Machine = Server.CreateObject("ADODB.Recordset")
Machine.ActiveConnection = MM_GPC_STRING
Machine.Source = "SELECT * FROM Webs ORDER BY machine ASC"
Machine.CursorType = 0
Machine.CursorLocation = 2
Machine.LockType = 1
Machine.Open()

Machine_numRows = 0
%>
<%
Dim testing__MMColParam
testing__MMColParam = "0"
If (Request.QueryString("prodid") <> "") Then
  testing__MMColParam = Request.QueryString("prodid")
End If
%>
<%
Dim testing
Dim testing_numRows

Set testing = Server.CreateObject("ADODB.Recordset")
testing.ActiveConnection = MM_GPC_STRING
testing.Source = "SELECT SBDCPOS, SBDIENUM, SBNUM2test, SBUCL, SBLCL, SBTGT, SBPT1, SBPT2, SBPT3, SBPT4, SBPT5, SBPT6, SBPT7, SBPT8, SBPT9, SBPT10, SBPT11, SBPT12, SBPT13, SBPT14, SBPT15, SBPT16, SBPT17, SBPT18, SBPT19, SBPT20  FROM OFCONTROL  WHERE productid = " + Replace(testing__MMColParam, "'", "''") + ""
testing.CursorType = 0
testing.CursorLocation = 2
testing.LockType = 1
testing.Open()

testing_numRows = 0
%>
<%
Dim count__MMColParam
count__MMColParam = "1"
If (Request.QueryString("prodid") <> "") Then
  count__MMColParam = Request.QueryString("prodid")
End If
%>
<%
Dim count
Dim count_numRows

Set count = Server.CreateObject("ADODB.Recordset")
count.ActiveConnection = MM_GPC_STRING
count.Source = "SELECT *  FROM OFCONTROL  WHERE productid = " + Replace(count__MMColParam, "'", "''") + ""
count.CursorType = 0
count.CursorLocation = 2
count.LockType = 1
count.Open()

count_numRows = 0
%>
<%
Dim SBCONTROL__MMColParam
SBCONTROL__MMColParam = "0"
If (Request.QueryString("prodid") <> "") Then
  SBCONTROL__MMColParam = Request.QueryString("prodid")
End If
%>
<%
Dim SBCONTROL
Dim SBCONTROL_numRows

Set SBCONTROL = Server.CreateObject("ADODB.Recordset")
SBCONTROL.ActiveConnection = MM_GPC_STRING
SBCONTROL.Source = "SELECT *  FROM OFCONTROL  WHERE productid = " + Replace(SBCONTROL__MMColParam, "'", "''") + ""
SBCONTROL.CursorType = 0
SBCONTROL.CursorLocation = 2
SBCONTROL.LockType = 1
SBCONTROL.Open()

SBCONTROL_numRows = 0
%>
<%
Dim DCPOS__MMColParam
DCPOS__MMColParam = "0"
If (Request.QueryString("prodid")  <> "") Then
  DCPOS__MMColParam = Request.QueryString("prodid")
End If
%>
<%
Dim DCPOS
Dim DCPOS_numRows

Set DCPOS = Server.CreateObject("ADODB.Recordset")
DCPOS.ActiveConnection = MM_GPC_STRING
DCPOS.Source = "SELECT *  FROM Sb  WHERE productid = " + Replace(DCPOS__MMColParam, "'", "''") + ""
DCPOS.CursorType = 0
DCPOS.CursorLocation = 2
DCPOS.LockType = 1
DCPOS.Open()

DCPOS_numRows = 0
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim SBCONTROL_total
Dim SBCONTROL_first
Dim SBCONTROL_last

' set the record count
SBCONTROL_total = SBCONTROL.RecordCount

' set the number of rows displayed on this page
If (SBCONTROL_numRows < 0) Then
  SBCONTROL_numRows = SBCONTROL_total
Elseif (SBCONTROL_numRows = 0) Then
  SBCONTROL_numRows = 1
End If

' set the first and last displayed record
SBCONTROL_first = 1
SBCONTROL_last  = SBCONTROL_first + SBCONTROL_numRows - 1

' if we have the correct record count, check the other stats
If (SBCONTROL_total <> -1) Then
  If (SBCONTROL_first > SBCONTROL_total) Then
    SBCONTROL_first = SBCONTROL_total
  End If
  If (SBCONTROL_last > SBCONTROL_total) Then
    SBCONTROL_last = SBCONTROL_total
  End If
  If (SBCONTROL_numRows > SBCONTROL_total) Then
    SBCONTROL_numRows = SBCONTROL_total
  End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (SBCONTROL_total = -1) Then

  ' count the total records by iterating through the recordset
  SBCONTROL_total=0
  While (Not SBCONTROL.EOF)
    SBCONTROL_total = SBCONTROL_total + 1
    SBCONTROL.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (SBCONTROL.CursorType > 0) Then
    SBCONTROL.MoveFirst
  Else
    SBCONTROL.Requery
  End If

  ' set the number of rows displayed on this page
  If (SBCONTROL_numRows < 0 Or SBCONTROL_numRows > SBCONTROL_total) Then
    SBCONTROL_numRows = SBCONTROL_total
  End If

  ' set the first and last displayed record
  SBCONTROL_first = 1
  SBCONTROL_last = SBCONTROL_first + SBCONTROL_numRows - 1
 
  If (SBCONTROL_first > SBCONTROL_total) Then
    SBCONTROL_first = SBCONTROL_total
  End If
  If (SBCONTROL_last > SBCONTROL_total) Then
    SBCONTROL_last = SBCONTROL_total
  End If

End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables

Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined

Dim MM_param
Dim MM_index

Set MM_rs    = DCPOS
MM_rsCount   = DCPOS_total
MM_size      = DCPOS_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  MM_param = Request.QueryString("index")
  If (MM_param = "") Then
    MM_param = Request.QueryString("offset")
  End If
  If (MM_param <> "") Then
    MM_offset = Int(MM_param)
  End If

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
  If (MM_rs.EOF) Then
    MM_offset = MM_index  ' set MM_offset to the last possible record
  End If

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  MM_index = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsCount) Then
      MM_size = MM_rsCount
    End If
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rs.EOF And MM_index < MM_offset)
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
DCPOS_first = MM_offset + 1
DCPOS_last  = MM_offset + MM_size

If (MM_rsCount <> -1) Then
  If (DCPOS_first > MM_rsCount) Then
    DCPOS_first = MM_rsCount
  End If
  If (DCPOS_last > MM_rsCount) Then
    DCPOS_last = MM_rsCount
  End If
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev

Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    MM_paramList = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For MM_paramIndex = 0 To UBound(MM_paramList)
      MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
      If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then
  MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If

MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="

MM_moveFirst = MM_urlStr & "0"
MM_moveLast  = MM_urlStr & "-1"
MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
  MM_movePrev = MM_urlStr & "0"
Else
  MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Scorebend Input</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
      background-image: url(/Images/Opening%20Force.bmp);
}
.style7 {color: #FF0000}
.style8 {
      color: #336600;
      font-weight: bold;
}
.style10 {color: #FF0000; font-weight: bold; }
.style11 {
      color: #0000FF;
      font-weight: bold;
}

-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}
//-->
</script>
</head>
<BODY OnLoad="document.form1.Work_Order_Number.focus();">
<h2><a href="index.htm">
  </a></h2>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1">
  <table width="62%"  border="1" cellspacing="0" cellpadding="2">
    <tr>
      <th width="12%" scope="col"><strong>Item</strong></th>
      <th width="36%" scope="col"><div align="left">
          <input name="proddesc" type="text" id="proddesc2" value="<%=(SBCONTROL.Fields.Item("proddesc").Value)%>" readonly="true">
      </div></th>
      <th width="14%" scope="col"><div align="right"></div></th>
      <td width="9%"><div align="center" class="style7 style2"><strong>UCL</strong></div></td>
      <td width="15%"><div align="center" class="style3 style8">TARGET</div></td>
      <td width="14%"><div align="center" class="style7 style5 style4"><strong>LCL</strong></div></td>
    </tr>
    <tr>
      <td><strong>Coating</strong></td>
      <td><div align="left"><strong>
          <input name="COAT" type="text" id="COAT" value="<%=(SBCONTROL.Fields.Item("cofcoat").Value)%>" size="15">
      </strong> </div></td>
      <td><div align="right"> </div></td>
      <td><div align="center">
          <input name="UCL" type="text" id="UCL" value="<%=(SBCONTROL.Fields.Item("SBUCL").Value)%>" size="5" readonly="true">
      </div></td>
      <td><div align="center">
          <input name="STAT_TGT" type="text" id="STAT_TGT" value="<%=(SBCONTROL.Fields.Item("SBTGT").Value)%>" size="5" readonly="true">
      </div></td>
      <td><div align="center">
          <input name="STAT_LCL" type="text" id="STAT_LCL" value="<%=(SBCONTROL.Fields.Item("SBLCL").Value)%>" size="5" readonly="true">
      </div></td>
    </tr>
    <tr>
      <td><div align="center"><strong>Date</strong></div></td>
      <td>
        <div align="left">
          <input name="sampdate" type="text" id="sampdate" value="<%= Date() %>" size="15">
      </div></td>
      <td><div align="right"></div></td>
      <td>&nbsp; </td>
      <td>&nbsp; </td>
      <td>&nbsp; </td>
    </tr>
  </table>
  <table width="62%" height="134"  border="1" cellpadding="2" cellspacing="0">
    <tr>
      <th width="11%" scope="col"><div align="center"><strong>Time</strong></div></th>
      <th width="17%" scope="col"><div align="left">
          <input name="samptime" type="text" id="samptime2" value="<% = Time() %>" size="15">
      </div></th>
      <th width="12%" scope="col"><div align="left"><strong>Order No. </strong></div></th>
      <th width="13%" scope="col"><div align="left">
          <input name="Work_Order_Number" type="text" id="Work_Order_Number" size="10">
      </div></th>
      <th width="11%" scope="col">Machine</th>
      <th width="36%" scope="col"><select name="MACH" id="MACH" onChange="YY_checkform('form1','MACH','#q','1','Select Operator');return document.MM_returnValue">
          <%
While (NOT Machine.EOF)
%>
          <option value="<%=(Machine.Fields.Item("machine").Value)%>"><%=(Machine.Fields.Item("machine").Value)%></option>
          <%
  Machine.MoveNext()
Wend
If (Machine.CursorType > 0) Then
  Machine.MoveFirst
Else
  Machine.Requery
End If
%>
      </select></th>
    </tr>
    <tr>
      <td><div align="center" class="style6 style1"><strong>Die # </strong></div></td>
      <td><input name="sbdienum" type="text" id="sbdienum" value="<%=(SBCONTROL.Fields.Item("SBDIENUM").Value)%>" size="15">
      </td>
      <td><div align="center" class="style1"><strong>Die Pos. </strong></div></td>
      <td><input name="sbdcpos" type="text" id="sbdcpos" value="<%=(SBCONTROL.Fields.Item("SBDCPOS").Value)%>" size="10"></td>
      <td><div align="center"><strong>Operator</strong></div></td>
      <td><div align="center">
          <select name="OPERATOR" id="select" onChange="YY_checkform('form1','select','#q','1','Select Press #');return document.MM_returnValue">
            <%
While (NOT operators.EOF)
%>
            <option value="<%=(operators.Fields.Item("OPname").Value)%>"><%=(operators.Fields.Item("OPname").Value)%></option>
            <%
  operators.MoveNext()
Wend
If (operators.CursorType > 0) Then
  operators.MoveFirst
Else
  operators.Requery
End If
%>
          </select>
      </div></td>
    </tr>
    <tr>
      <td><div align="center"><strong>Board</strong></div></td>
      <td><input name="cofboard" type="text" id="cofboard" value="<%=(SBCONTROL.Fields.Item("cofboard").Value)%>" size="15"></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <div align="left"> </div>
  <p align="left"><span class="style10">Carton #</span>
      <input name="CARTnum" type="text" id="CARTnum" value="<%=(SBCONTROL_first)%>" size="3">
  of
  <input name="totcart" type="text" id="totcart" value="<%=(SBCONTROL.Fields.Item("SBNUM2test").Value)%>" size="3">
  </p>
  <div align="left">
    <table width="36%"  border="1" cellpadding="2" cellspacing="0" id="c1">
      <tr>
        <th scope="col"><div align="center">Score</div></th>
        <th scope="col"><div align="center">Board</div></th>
        <th scope="col"><div align="center">Score</div></th>
        <th scope="col"><div align="center">% Efficency </div></th>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT1").Value) = 1 Then%>
        <td><div align="center">1</div></td>
        <td><div align="center">
            <input name="b1" type="text" id="b1" size="6">
        </div></td>
        <td><div align="center">
            <input name="s1" type="text" id="s1" size="6">
        </div></td>
        <td><div align="center">
            <input name="e1" type="text" id="e1" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT2").Value) = 1 Then%>
        <td><div align="center">2</div></td>
        <td><div align="center">
            <input name="b2" type="text" id="b2" size="6">
        </div></td>
        <td><div align="center">
            <input name="s2" type="text" id="s2" size="6">
        </div></td>
        <td><div align="center">
            <input name="e2" type="text" id="e2" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT3").Value) = 1 Then%>
        <td><div align="center">3</div></td>
        <td><div align="center">
            <input name="b3" type="text" id="b3" size="6">
        </div></td>
        <td><div align="center">
            <input name="s3" type="text" id="s3" size="6">
        </div></td>
        <td><div align="center">
            <input name="e3" type="text" id="e3" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT4").Value) = 1 Then%>
        <td><div align="center">4</div></td>
        <td><div align="center">
            <input name="b4" type="text" id="b4" size="6">
        </div></td>
        <td><div align="center">
            <input name="s4" type="text" id="s4" size="6">
        </div></td>
        <td><div align="center">
            <input name="e4" type="text" id="e4" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT5").Value) = 1 Then%>
        <td><div align="center">5</div></td>
        <td><div align="center">
            <input name="b5" type="text" id="b5" size="6">
        </div></td>
        <td><div align="center">
            <input name="s5" type="text" id="s5" size="6">
        </div></td>
        <td><div align="center">
            <input name="e5" type="text" id="e5" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT6").Value) = 1 Then%>
        <td><div align="center">6</div></td>
        <td><div align="center">
            <input name="b6" type="text" id="b6" size="6">
        </div></td>
        <td><div align="center">
            <input name="s6" type="text" id="s6" size="6">
        </div></td>
        <td><div align="center">
            <input name="e6" type="text" id="e6" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT7").Value) = 1 Then%>
        <td><div align="center">7</div></td>
        <td><div align="center">
            <input name="b7" type="text" id="b7" size="6">
        </div></td>
        <td><div align="center">
            <input name="s7" type="text" id="s7" size="6">
        </div></td>
        <td><div align="center">
            <input name="e7" type="text" id="e7" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT8").Value) = 1 Then%>
        <td><div align="center">8</div></td>
        <td><div align="center">
            <input name="b8" type="text" id="b8" size="6">
        </div></td>
        <td><div align="center">
            <input name="s8" type="text" id="s8" size="6">
        </div></td>
        <td><div align="center">
            <input name="e8" type="text" id="e8" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT9").Value) = 1 Then%>
        <td><div align="center">9</div></td>
        <td><div align="center">
            <input name="b9" type="text" id="b9" size="6">
        </div></td>
        <td><div align="center">
            <input name="s9" type="text" id="s9" size="6">
        </div></td>
        <td><div align="center">
            <input name="e9" type="text" id="e9" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT10").Value) = 1 Then%>
        <td><div align="center">10</div></td>
        <td><div align="center">
            <input name="b10" type="text" id="b10" size="6">
        </div></td>
        <td><div align="center">
            <input name="s10" type="text" id="s10" size="6">
        </div></td>
        <td><div align="center">
            <input name="e10" type="text" id="e10" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT11").Value) = 1 Then%>
        <td><div align="center">11</div></td>
        <td><div align="center">
            <input name="b11" type="text" id="b11" size="6">
        </div></td>
        <td><div align="center">
            <input name="s11" type="text" id="s11" size="6">
        </div></td>
        <td><div align="center">
            <input name="e11" type="text" id="e11" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT12").Value) = 1 Then%>
        <td><div align="center">12</div></td>
        <td><div align="center">
            <input name="b12" type="text" id="b12" size="6">
        </div></td>
        <td><div align="center">
            <input name="s12" type="text" id="s12" size="6">
        </div></td>
        <td><div align="center">
            <input name="e12" type="text" id="e12" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT13").Value) = 1 Then%>
        <td><div align="center">13</div></td>
        <td><div align="center">
            <input name="b13" type="text" id="b13" size="6">
        </div></td>
        <td><div align="center">
            <input name="s13" type="text" id="s13" size="6">
        </div></td>
        <td><div align="center">
            <input name="e13" type="text" id="e13" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT14").Value) = 1 Then%>
        <td><div align="center">14</div></td>
        <td><div align="center">
            <input name="b14" type="text" id="b14" size="6">
        </div></td>
        <td><div align="center">
            <input name="s14" type="text" id="s14" size="6">
        </div></td>
        <td><div align="center">
            <input name="e14" type="text" id="e14" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT15").Value) = 1 Then%>
        <td><div align="center">15</div></td>
        <td><div align="center">
            <input name="b15" type="text" id="b15" size="6">
        </div></td>
        <td><div align="center">
            <input name="s15" type="text" id="s15" size="6">
        </div></td>
        <td><div align="center">
            <input name="e15" type="text" id="e15" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT16").Value) = 1 Then%>
        <td><div align="center">16</div></td>
        <td><div align="center">
            <input name="b16" type="text" id="b16" size="6">
        </div></td>
        <td><div align="center">
            <input name="s16" type="text" id="s16" size="6">
        </div></td>
        <td><div align="center">
          <input name="e16" type="text" id="e16" size="6">
</div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT17").Value) = 1 Then%>
        <td><div align="center">17</div></td>
        <td><div align="center">
            <input name="b17" type="text" id="b17" size="6">
        </div></td>
        <td><div align="center">
            <input name="s17" type="text" id="s17" size="6">
        </div></td>
        <td><div align="center">
            <input name="e17" type="text" id="e17" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT18").Value) = 1 Then%>
        <td><div align="center">18</div></td>
        <td><div align="center">
            <input name="b18" type="text" id="b18" size="6">
        </div></td>
        <td><div align="center">
            <input name="s18" type="text" id="s18" size="6">
        </div></td>
        <td><div align="center">
            <input name="e18" type="text" id="e18" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT19").Value) = 1 Then%>
        <td><div align="center">19</div></td>
        <td><div align="center">
            <input name="b19" type="text" id="b19" size="6">
        </div></td>
        <td><div align="center">
            <input name="s19" type="text" id="s19" size="6">
        </div></td>
        <td><div align="center">
            <input name="e19" type="text" id="e19" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
      <tr>
        <%If (testing.Fields.Item("SBPT20").Value) = 1 Then%>
        <td><div align="center">20</div></td>
        <td>
          <div align="center">
            <input name="b20" type="text" id="b20" size="6">
        </div></td>
        <td>
          <div align="center">
            <input name="s20" type="text" id="s20" size="6">
        </div></td>
        <td>
          <div align="center">
            <input name="e20" type="text" id="e20" size="6">
        </div></td>
        <%Else%>
        <%End If%>
      </tr>
    </table>
  </div>
  <p><strong>Comments </strong></p>
  <p>
    <input name="COMMENTS" type="text" id="COMMENTS" value="" size="50">
  </p>
  <p>
    <input name="Submit" type="submit" value= "Submit">
  </p>
  <input type="hidden" name="MM_insert" value="form1">
</form>


<p class="style7">&nbsp;</p>
<span class="style11"> </span>
</body>
</html>
<%
operators.Close()
Set operators = Nothing
%>
<%
Machine.Close()
Set Machine = Nothing
%>
<%
testing.Close()
Set testing = Nothing
%>
<%
count.Close()
Set count = Nothing
%>
<%
SBCONTROL.Close()
Set SBCONTROL = Nothing
%>
<%
DCPOS.Close()
Set DCPOS = Nothing
%>



0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rockmansatticCommented:
I still suggest the previous answer.  

I may not unerstand the question. (I definatly dont unerstand the form)
you want to increment the carton number?
is this number to be incremented +1 each time?

if this is the case, I still suggest my previous post.  Because MSaccess can increment the id or any other number automatically for you.

OR

you could do something like this if you dont want msaccess to do it.
retrieve the last carton number and have it as a hidden field or somthing and have it be +1.

Is there a reason for you wanting to predefine the number of entries you are going to do?
It would be easier to just insert entries until you are done, then quit (adding a cancel button beside submit)


Rockman

0
 
PastianAuthor Commented:
Thanks again Rockman

Pardon me for my "explanation"

This is seemingly a simple task that i am having a problem with.

In this application an operator will enter Multiple quality readings(variable) on multiple Cartons(variable).
Try to think of this in terms of an operator gathering x cartons and taking x readings on each carton
we tell them how many cartons to gather and which readings we want on each carton

1. Depending on the product selected(on a previous pulldown) the form displays the readings to take. (This form has a possibility of 20 readings)
 
I did this by checking the control file for which readings to take

ie;

<%If (testing.Fields.Item("SBPT1").Value) = 1 Then%>
        <td><div align="center">1</div></td>
        <td><div align="center">
            <input name="b1" type="text" id="b1" size="6">
        </div></td>
        <td><div align="center">
            <input name="s1" type="text" id="s1" size="6">
        </div></td>
        <td><div align="center">
            <input name="e1" type="text" id="e1" onBlur="YY_CalculateForm('document.form1','e1','2','\(','#s1','/','#b1','\)')" size="6">
        </div></td>
        <%Else%>
        <%End If%>

all this is doing is displaying a row in a table if the manager wants this reading taken.

2.  Now we need to insert those readings for that carton and go to the next carton????
    thats where im having trouble.

A redirect back to the same page does not keep all the form variables nor will it increment to the next carton

Im still lost
0
 
triserosCommented:
OK just quick thing I have noticed - you are filtering your recordset data using request.querystring("prodid") - however, when you submit your form you are submitting using the POST method which means that your request.querystring("prodid") value is now null.

To rectify this you need to do two things...

1.    Add a hidden field of prodid into your form...   <input name="hiddenField" type="hidden" value="<%=request("prodid")%>">

2.   Go through your code and replace  request.querystring("prodid") filter for your recordsets with just  request("prodid")  this will then pick up the variable prodid regardless of whether it's a form or querystring.

Resolve this issue first and let me know how you get on (it should fix the problem of your keeping your form variables)

Paul
0
 
PastianAuthor Commented:
Thanks Paul!

Good Eye!

I have made those changes.  Would be awesome to retain all but the actual readings and increment to next Carton

Thanks

HP
0
 
triserosCommented:
Can you tell me what is outstanding as a result of those changes...
0
 
triserosCommented:
OK Going through your code -  I can see that your carton Number (form value CARTnum) is always set to the first value of your recordset SBCONTROL an as there is no control over the position of this recordset you need to specify this manually.

The best way to do this is to create a session variable Session("SBCONTROL") and increment this each time the page loads

<%
'if this is the first time the page has loaded then assume that this is the first carton for testing
If Session("SBCONTROL") = "" then
Session("SBCONTROL") = SBCONTROL_first
    'if it isn't then increment the carton Number if it is less than the total cartons needed
    Elseif Session("SBCONTROL") <>"" AND Session("SBControl") <= SBCONTROL_total
           Then Session("SBCONTROL") = int(Session("SBControl")) +1
             'otherwise redirect to the nex page
             Else Response.redirect("whereEverYouWantToGoNext.asp")
 End If
%>

The make your carton counter display your session variable instead of your first record

<input name="CARTnum" type="text" id="CARTnum" value="<%=Session("SBCONTROL")%>" size="3">
0
 
PastianAuthor Commented:
Paul:

U Da Man!, I modified your code a smidge to:


<%
    If Session("SBCONTROL") = "" then
Session("SBCONTROL") = SBCONTROL_first
    Elseif Session("SBCONTROL") <>"" AND Session("SBCONTROL") < ((SBCONTROL.Fields.Item("SBDCPOS").Value)) Then
Session("SBCONTROL") = int(Session("SBCONTROL")) +1
      Else Session("SBCONTROL") = Null and Response.redirect("sbprodselect.asp")
 End If
%>

This allows for adding more readings later without logging off.

The points are yours!

Thanks tons!

HP
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now