Issue: I am inserting an Oracle record containing insert trigger via
Access 2002 using the code below. The issue is that the sequence from
the acSaveRecord is not reflected after the insert so the insert into
the second table section: ' Copy LOB entries now. fails on unique
index constraint (understandable because it has the orig rate_id).
The strange thing is that it works fine for new records that have
beend added and then cloned using the source below but not for
acess-to-oracle converted records.
Is there a way so save the seq value to a variable? I need to make
sure it is the one I just assigned via the Oracle trigger.
Table relationship: CMPLY_FUND_RATE _DETAIL (1) ---
CMPLY_FUND_LOB( Many)
Source:
Private Sub cmdNewRate_Clic k()
On Error GoTo Err_cmdNewRate_ Click
Dim txtAccount As String
Dim txtFundName As String
Dim lRateID As Long
Dim txtSQLStatement As String
If (Me![EXP_DATE] <= Me![EFF_DATE]) Then
MsgBox "Please confirm Effective and Expiration Dates. The
Expiration Date is prior or equal to the the Effective Date.",
vbInformation + vbOKOnly
Me![EXP_DATE].SetFocus
GoTo Exit_cmdNewRate _Click
End If
lRateID = Me![RATE_ID]
txtAccount = Me![ACCOUNT]
txtFundName = Me![FUND_NAME]
DoCmd.GoToRecor d , , acNewRec
' Set Key Fields and copy over existing LOB from current rate
Me![FUND_NAME] = txtFundName
Me![ACCOUNT] = txtAccount
' Need to Save the keys info prior to copying LOB's
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
--->>> *** this should generate a new rate_id (insert trigger
on CMPLY_FUND_RATE _DETAIL which
the form is tied to)
' Copy LOB entries now.
txtSQLStatement = "INSERT INTO CMPLY_FUND_LOB ( RATE_ID,
[LINE_OF_BUSINES S] )"
txtSQLStatement = txtSQLStatement & " SELECT RATE_ID ,
LINE_OF_BUSINES S"
txtSQLStatement = txtSQLStatement & " FROM CMPLY_FUND_LOB WHERE
RATE_ID = " & lRateID
DoCmd.RunSQL txtSQLStatement , True
Me![lstActiveLOB].Requery
Me![RATE].SetFocus
Exit_cmdNewRate _Click:
Exit Sub
Err_cmdNewRate_ Click:
MsgBox Err.Description
Resume Exit_cmdNewRate _Click
End Sub