Hi, i am having some trouble having modified this script in getting the code to differentiate between which key is pressed on a form. What ever I do it either sees insert or cancel the key pressed as a &#039;cancel&#039; i.e do nothing or as an &#039;insert&#039; but not both at the same time. What i mean by that is however I configure the code when the page is submitted pressing either button on the form &#039;Insert&#039; or &#039;Cancel&#039; the form will either only insert or cancel. If I change the Operation mode from Edit to Update it will update only I have it on Edit as I thought this was correct for inserting a record and editing.<BR><BR>I include part of the relevant code in case anyone can see an obvious error.<BR><BR><BR>Here&#039;s the start as it is configured now it only inserts a record even if the key pressed is Cancel and i am not clever enough in programming to know why, sorry. and sorry if this is too long a post.<BR><BR>&#039;property1 Class_Initialize Event<BR> Private Sub Class_Initialize()<BR><BR> Visible = True<BR> Set Errors = New clsErrors<BR> Set CCSEvents = CreateObject("Scripting.Dictionary")<BR> Set DataSource = New clsproperty1DataSource<BR> Set Command = New clsCommand<BR> InsertAllowed = True<BR> Dim Method<BR> Dim OperationMode<BR> <BR> If Visible Then<BR> OperationMode = Split(Request.QueryString("ccsForm"), ":")<BR> If UBound(OperationMode) &#062; -1 Then <BR> FormSubmitted = (OperationMode(0) = "property1")<BR> End If<BR> If UBound(OperationMode) &#062; 0 Then <BR> EditMode = (OperationMode(1) = "Edit")<BR> End If<BR> ComponentName = "property1"<BR> Method = IIf(FormSubmitted, ccsPost, ccsGet)<BR> Set listDate = CCCreateControl(ccsTextBox, "listDate", "List Date", ccsDate, Empty, CCGetRequestParam("listDate", Method))<BR><BR>"<BR>"blahh blahh<BR><BR><BR><BR> Here is where it sets up the buttons<BR><BR> &#039;property1 Operation Method <BR> Sub Operation()<BR> If NOT ( Visible AND FormSubmitted ) Then Exit Sub<BR><BR> If FormSubmitted Then<BR> PressedButton = IIf(EditMode, "Button_Update", "Button_Insert")<BR> If Not IsEmpty(CCGetParam("Button_Insert", Empty)) Then<BR> PressedButton = "Button_Insert"<BR> ElseIf Not IsEmpty(CCGetParam("Button_Update", Empty)) Then<BR> PressedButton = "Button_Update"<BR> ElseIf Not IsEmpty(CCGetParam("Button_Delete", Empty)) Then<BR> PressedButton = "Button_Delete"<BR> ElseIf Not IsEmpty(CCGetParam("Button_Cancel", Empty)) Then<BR> PressedButton = "Button_Cancel"<BR> End If<BR> End If<BR> Redirect = "set_top10.asp?" & CCGetQueryString("QueryString", Array("ccsForm", "Button_Insert", "Button_Update", "Button_Delete", "Button_Cancel"))<BR> If PressedButton = "Button_Delete" Then<BR> If NOT Button_Delete.OnClick OR NOT DeleteRow() Then<BR> Redirect = ""<BR> End If<BR> ElseIf PressedButton = "Button_Cancel" Then<BR> If NOT Button_Cancel.OnClick Then<BR> Redirect = ""<BR> End If<BR> ElseIf PressedButton = "Button_Insert" Then<BR> If NOT Button_Insert.OnClick() OR NOT InsertRow() Then<BR> Redirect = ""<BR> End If<BR> ElseIf PressedButton = "Button_Update" Then<BR> If NOT Button_Update.OnClick() OR NOT UpdateRow() Then<BR> Redirect = ""<BR> End If<BR> <BR> Else<BR> Redirect = ""<BR> End If<BR> End Sub<BR>&#039;End property1 Operation Method<BR><BR><BR><BR>And this is one of the routines for the key pressed<BR><BR><BR>&#039;property1 InsertRow Method<BR> Function InsertRow()<BR> CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeInsert", Me)<BR> If NOT InsertAllowed Then InsertRow = False : Exit Function<BR> DataSource.listDate.Value = listDate.Value<BR> DataSource.realtorid.Value = realtorid.Value<BR> DataSource.agencyid.Value = agencyid.Value<BR> DataSource.title.Value = title.Value<BR> DataSource.price.Value = price.Value<BR> DataSource.description1.Value = description1.Value<BR> DataSource.features.Value = features.Value<BR> DataSource.Insert(Command)<BR> <BR> CCSEventResult = CCRaiseEvent(CCSEvents, "AfterInsert", Me)<BR> If DataSource.Errors.Count &#062; 0 Then<BR> PrintDBError "Record " & ComponentName & " / Insert Operation", DataSource.Connection.LastSQL, DataSource.Errors.ToString()<BR> DataSource.Errors.Clear<BR> Errors.AddError "Database command error."<BR> End If<BR> InsertRow = (Errors.Count = 0)<BR> End Function<BR>&#039;End property1 InsertRow Method<BR><BR>