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

Start and Stop time in ASP

Status
Not open for further replies.

skw8966

Programmer
Apr 12, 2001
59
0
0
US
I have an Active Server Page connected to an MS Access database. I use this page to submit information to the database. Among the form fields is a start time and stop time field. By setting the value of start time to
Code:
<%=Time()%>
, I'm able to collect the start time automatically when the new form is opened. I would also like to collect the stop time by clicking the submit button.

How can this be accomplished?

Thanks.
 
Isn't the form action another ASP file? Why not collect the stop time in that file?


-k
 
The page submits directly to the database.

Below is the page code:

Code:
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
	Err.Clear

	Set fp_conn =  Server.CreateObject("ADODB.Connection")
	FP_DumpError strErrorUrl, "Cannot create connection"

	Set fp_rs = Server.CreateObject("ADODB.Recordset")
	FP_DumpError strErrorUrl, "Cannot create record set"

	fp_conn.Open Application("Database1_ConnectionString")
	FP_DumpError strErrorUrl, "Cannot open database"

	fp_rs.Open "tblFastInput", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
	FP_DumpError strErrorUrl, "Cannot open record set"

	fp_rs.AddNew
	FP_DumpError strErrorUrl, "Cannot add new record set to the database"
	Dim arFormFields0(6)
	Dim arFormDBFields0(6)
	Dim arFormValues0(6)

	arFormFields0(0) = "Account"
	arFormDBFields0(0) = "Acct"
	arFormValues0(0) = Request("Account")
	arFormFields0(1) = "Type"
	arFormDBFields0(1) = "Type"
	arFormValues0(1) = Request("Type")
	arFormFields0(2) = "Parts"
	arFormDBFields0(2) = "Part"
	arFormValues0(2) = Request("Parts")
	arFormFields0(3) = "Name"
	arFormDBFields0(3) = "EmpName"
	arFormValues0(3) = Request("Name")
	arFormFields0(4) = "Time"
	arFormDBFields0(4) = "Time"
	arFormValues0(4) = Request("Time")
	arFormFields0(5) = "Date"
	arFormDBFields0(5) = "Date"
	arFormValues0(5) = Request("Date")

	FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


	fp_rs.Update
	FP_DumpError strErrorUrl, "Cannot update the database"

	fp_rs.Close
	fp_conn.Close

	Session("FP_SavedFields")=arFormFields0
	Session("FP_SavedValues")=arFormValues0
	Response.Redirect "[URL unfurl="true"]http://172.25.205.106/Office/BarbFaxInput.asp"[/URL]

End If
End If

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--" name="Office">
  <!--webbot bot="SaveDatabase" SuggestedExt="asp"
  U-ASP-Include-Url="../_fpclass/fpdbform.inc" S-DataConnection="Database1"
  S-RecordSource="tblFastInput"
  U-Confirmation-Url="[URL unfurl="true"]http://172.25.205.106/Office/BarbFaxInput.asp"[/URL]
  S-Form-Fields="Timeout Account Type Parts Name Time Date"
  S-Form-DBFields="TimeOut Acct Type Part EmpName Time Date" -->
  <table border="1" width="102%">
    <tr>
      <td width="102%" colspan="6">
        <p align="center"><b>Fast Incoming Orders</b></td>
    </tr>
    <tr>
      <td width="16%" align="center">Account #</td>
      <td width="16%" align="center">Code</td>
      <td width="16%" align="center">Parts</td>
      <td width="17%" align="center">&nbsp;</td>
      <td width="17%" align="center">Type</td>
      <td width="17%" align="center">Date</td>
      <td width="19%" align="center">Time In</td>
      <td width="17%" align="center">Time Out</td>
      <td width="17%" align="center">Name</td>
    </tr>
    <tr>
      <td width="16%" align="center"><input type="text" name="Account" size="20" tabindex="1"></td>
      <td width="10%" align="center"><input type="text" name="T1" size="4"></td>
      <td width="10%" align="center"><input type="text" name="Parts" size="4" tabindex="2"></td>
      <td width="17%" align="center"><input type="submit" value="Submit" name="B1" tabindex="3"></td>
      <td width="12%" align="center"><input type="text" name="Type" size="12" value="Fax"></td>
      <td width="17%" align="center"><input type="text" name="Date" size="13" value="<%=Date()%>" tabindex="5"></td>
      <td width="19%" align="center"><input type="text" name="Time" size="10" value="<%=Time()%>"></td>
      <td width="17%" align="center"><input type="text" name="Timeout" size="8"></td>
      <td width="17%" align="center"><input type="text" name="Name" size="7" value="Barb"></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
<script language="JavaScript"> document.forms[0].Account.focus(); </script>
</body>

</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top