My Assistant
![]() ![]() |
|
|
Mar 29 2006, 04:50 AM
Post
#1
|
|
|
UtterAccess Member Posts: 34 |
I am trying to insert a post which already exist. If it exists i don't want to write the post in the table.
Doing this is by select case in errorhandler My problem is that i don't get a chance to taking care of the sql-error code since i am doing DoCmd.RunSQL (strSQL). The sql-code: strSQL = "INSERT INTO Rapp_Temp" strSQL = strSQL & " ([ID-PROJEKTDELTAGARE], [DA-AR], [ID-AKTIVITET], [ID-PROJEKT], [BE-PROJEKT], [BE-AKTIVITET])" strSQL = strSQL & " VALUES (" & TidrappTab(ixa, 2) & ", " & TidrappTab(ixa, 6) & ", " & TidrappTab(ixa, 1) & "," strSQL = strSQL & " " & id_proj & ", '" & be_proj & "', '" & be_akt & "');" DoCmd.RunSQL (strSQL) When i use Set qdf = dbThis.CreateQueryDef("", strSQL) Set rst = qdf.OpenRecordset(dbOpenSnapshot) i came to errorhandler where i can use errorhandler: Select Case Err.Number Case 3021 plantemp_koll = 0 Resume Next Case Else MsgBox "Error=" Anyone knowing how to handle "post exists" and then continuing with next post? Thanks |
|
|
|
Mar 29 2006, 06:16 AM
Post
#2
|
|
|
UtterAccess Veteran Posts: 362 From: Brazil |
Perhaps you should rather check to see if the record exists first.
If it does not then you can post. That way you avoid a failure error. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 03:38 PM |