<%@LANGUAGE="VBSCRIPT"%> <% ' UltraSuite_Productivity_106: Retrieve ID of Last Inserted Record (Access) ' *** Edit Operations: declare variables Dim MM_editCmd Dim MM_editConnection Dim USX_editAction Dim USX_abortEdit Dim USX_editQuery Dim USX_editTable Dim USX_editRedirectUrl Dim USX_editColumn Dim USX_recordId Dim USX_fieldsStr Dim USX_columnsStr Dim USX_fields Dim USX_columns Dim USX_typeArray Dim USX_formVal Dim USX_delim Dim USX_altVal Dim USX_emptyVal Dim USX_i USX_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then USX_editAction = USX_editAction & "?" & Server.HTMLEncode(Request.QueryString) End If ' boolean to abort record edit USX_abortEdit = false ' query string to execute USX_editQuery = "" %> <% ' *** Insert Record: set variables If (CStr(Request("MM_insert")) = "frmQuote") Then MM_editConnection = MM_conSTR_STRING USX_editTable = "Quotes" USX_editRedirectUrl = "quotethanks.asp" USX_fieldsStr = "requestType|value|txtCompanyName|value|txtFirstName|value|txtLastName|value|txtCity|value|txtState|value|txtEmail|value|txtPhone|value|txtProjectName|value|txtSpecify|value" USX_columnsStr = "QuoteType|',none,''|CompanyName|',none,''|FName|',none,''|LName|',none,''|City|',none,''|State|',none,''|Email|',none,''|Phone1|',none,''|ProjectName|',none,''|ProjectSpecs|',none,''" ' create the USX_fields and USX_columns arrays USX_fields = Split(USX_fieldsStr, "|") USX_columns = Split(USX_columnsStr, "|") ' set the form values For USX_i = LBound(USX_fields) To UBound(USX_fields) Step 2 USX_fields(USX_i+1) = CStr(Request.Form(USX_fields(USX_i))) Next ' append the query string to the redirect URL If (USX_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, USX_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then USX_editRedirectUrl = USX_editRedirectUrl & "?" & Request.QueryString Else USX_editRedirectUrl = USX_editRedirectUrl & "&" & Request.QueryString End If End If End If %> <% ' *** Insert Record: construct a sql insert statement and execute it Dim USX_tableValues Dim USX_dbValues If (CStr(Request("MM_insert")) <> "") Then ' create the sql insert statement USX_tableValues = "" USX_dbValues = "" For USX_i = LBound(USX_fields) To UBound(USX_fields) Step 2 USX_formVal = USX_fields(USX_i+1) USX_typeArray = Split(USX_columns(USX_i+1),",") USX_delim = USX_typeArray(0) If (USX_delim = "none") Then USX_delim = "" USX_altVal = USX_typeArray(1) If (USX_altVal = "none") Then USX_altVal = "" USX_emptyVal = USX_typeArray(2) If (USX_emptyVal = "none") Then USX_emptyVal = "" If (USX_formVal = "") Then USX_formVal = USX_emptyVal Else If (USX_altVal <> "") Then USX_formVal = USX_altVal ElseIf (USX_delim = "'") Then ' escape quotes USX_formVal = "'" & Replace(USX_formVal,"'","''") & "'" Else USX_formVal = USX_delim + USX_formVal + USX_delim End If End If If (USX_i <> LBound(USX_fields)) Then USX_tableValues = USX_tableValues & "," USX_dbValues = USX_dbValues & "," End If USX_tableValues = USX_tableValues & USX_columns(USX_i) USX_dbValues = USX_dbValues & USX_formVal Next USX_editQuery = "insert into " & USX_editTable & " (" & USX_tableValues & ") values (" & USX_dbValues & ")" If (Not USX_abortEdit) Then ' execute the insert Set MM_editCmd = Server.CreateObject("ADODB.Recordset") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CursorType = 1 MM_editCmd.LockType = 3 MM_editCmd.Open USX_editTable, MM_editConnection MM_editCmd.AddNew For usx_i = LBound(USX_fields) To UBound(USX_fields) Step 2 If Len(USX_fields(USX_i+1)) > 0 AND USX_fields(USX_i+1)<> "''" Then MM_editCmd.Fields(USX_columns(USX_i)) = USX_fields(USX_i+1) End If Next MM_editCmd.Update Session("QuoteID") = MM_editCmd("QuoteID") MM_editCmd.ActiveConnection.Close If (USX_editRedirectUrl <> "") Then Response.Redirect(USX_editRedirectUrl) End If End If End If %> Request a Quote | Software That Rocks
Custom Software by Software That Rocks
Home Services Products Request Quote About Us Contact Us Support
 

Request a Quote

Find out how much it will cost to do exactly what you want.

We know that time is money, so you don't have all week to wait to hear back from a company; whether they can help or not. That's why when you request a quote from Software That Rocks, a professional account manager will contact you within 24 hours. Please complete the form below and click Submit when done. The fields with an asterick (*) are required.

Fields marked with * are required
 
Company Name:
  *
 
First Name:
  *
 
Last Name:
  *
 
City:
  *
 
State:
  *
 
E-mail address:
  *
 
Phone Number:
 
 
Project Name:
 
 
Project Description:
  *
       
 
   

To help us know what you need, please be as detailed as possible. Let us know what your current network environment is, technologies used and your desired solution outcome.

Send Request:

 

 

 
Home | Services | Products | Request Quote | About Us | Contact Us | Support

Copyright © 2006 | Software That Rocks | All rights reserved | View the Site Map

This page last updated: Monday, October 30, 2006 5:40 PM

 

Custom Software
Web Design
S.E.O.
Consulting
Upgrades
Password Manager
BugTrac
 
Free Stuff
Help files, tutorials. More
 
Press Room
Find out what's new here
 
Contact Us
Phone .:. 928.476.6570
E-mail .:. Sales
E-mail .:. Web-Master
 
Mailing Address
P.O. Box 1812
Pine, AZ 85544