fiogf49gjkf0d We customized the Insert Opportunity form and it used to work in 6.2.1.  We just upgraded to 7.0.1 and now when inserting a new opportunity it will not save the products.  It works fine if you add the products from the opportunity detail screen.
  I have compared the 6.2.1 and 7.0.1 versions and there isn't anything different from what I can find.  I've tested releasing the 6.2.1 version and it works fine.  This is the code that saves the products (at least this is what I think the code is..)  Can anyone spot why the products would not be saved when inserting an opportunity???
 
 Sub SaveOpportunityProductInfo     Dim objPrdRS, objRS     Dim i, strSQL
      Set objPrdRS = objSLXDB.GetNewRecordSet     objPrdRS.Locktype = adLockBatchOptimistic     strSQL = "Select * From OPPORTUNITY_PRODUCT Where 1=2"  'DNL     objPrdRS.Open strSQL, objSLXDB.Connection
      objPrdRS.ActiveConnection = Nothing     Set objRS = grdProducts.RecordSet
      If objRS.RecordCount > 0 Then        objSLXDB.CloseConnection        objRS.MoveFirst        For i = 0 To objRS.RecordCount - 1            With objPrdRS                 .AddNew                 .Fields("OPPPRODUCTID").Value = Application.BasicFunctions.GetIDFor("Opportunity_Product")  'DNL                 .Fields("OPPORTUNITYID").Value = strOpportunityID  'DNL                 .Fields("PRODUCTID").Value = objRS.Fields.Item("PRODUCTID").Value  'DNL                 .Fields("QUANTITY").Value = cDbl(CheckForNull(objRS.Fields.Item("QUANTITY").Value))  'DNL                 .Fields("DISCOUNT").Value = cDbl(CheckForNull(objRS.Fields.Item("DISCOUNT").Value))  'DNL                 .Fields("PRICE").Value = cDbl(CheckForNull(objRS.Fields.Item("PRICE").Value))  'DNL                 .Fields("EXTENDEDPRICE").Value = cDbl(CheckForNull(objRS.Fields.Item("EXTENDED").Value))  'DNL                 .Fields("CALCPRICE").Value = cDbl(CheckForNull(objRS.Fields.Item("ADJPRICE").Value))  'DNL                 .Fields("PROGRAM").Value = CheckForNull(objRS.Fields.Item("PRICELEVEL").Value)  'DNL                 .Fields("PRICEEFFDATE").Value = Now  'DNL                 .Fields("SORT").Value = CheckForNull(objRS.Fields.Item("SORT").Value)  'DNL            End With            objRS.MoveNext        Next
         objSLXDB.OpenConnection        Set objPrdRS.ActiveConnection = objSLXDB.Connection        objPrdRS.UpdateBatch     End If
      ' CTS 2006-12-06 4061 Create new recordset object for C_SIN_OPPPRODUCT update     Set objPrdRS = Nothing     Set objPrdRS = objSLXDB.GetNewRecordSet     objPrdRS.Locktype = adLockBatchOptimistic     strSQL = "Select * From C_SIN_OPPPRODUCT Where 1=2"     objPrdRS.Open strSQL, objSLXDB.Connection
      ' CTS 2006-12-06 4061 Get values from grid for update     objPrdRS.ActiveConnection = Nothing     Set objRS = grdProducts.RecordSet     If objRS.RecordCount > 0 Then        objSLXDB.CloseConnection        objRS.MoveFirst        For i = 0 To objRS.RecordCount - 1            With objPrdRS                 .AddNew                 .Fields("OPPPRODUCTID").Value = Application.BasicFunctions.GetIDFor("Opportunity_Product")                 .Fields("PROFIT_MARGIN").Value = cDbl(CheckForNull(objRS.Fields.Item("PROFITMARGIN").Value))  'DNL                 .Fields("PROFIT_AMOUNT").Value = cDbl(CheckForNull(objRS.Fields.Item("PROFITAMOUNT").Value))  'DNL            End With            objRS.MoveNext        Next        objSLXDB.OpenConnection        Set objPrdRS.ActiveConnection = objSLXDB.Connection        objPrdRS.UpdateBatch     End If
      objPrdRS.Close     Set objPrdRS = Nothing     Set objRS = Nothing End Sub
  
  Thanks, John G. |