Mada si dobio dobar savet od Zidara, npisaću ovde par redova, pa možda i još kome pomognemo.
Opis tvoje greške: 2501: The action was canceled. You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked Cancel in the dialog box that asks if you want to save the changes you made to the form.
Može se uhvatiti sa Error handling.
Code:
Private Sub NekoDugme_Click()
On Error GoTo Pokazi_Err
.....................................
neki kod kojim odrađuješ posao
.....................................
Pokazi_Err:
Select Case Err.Number
Case 2501: MsgBox "Poruka o grešci"
Case Else: MsgBox Err.Number & " " & Err.Description
End Select
Exit Sub
End Sub
3022: The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer) ’ Form Error event
Select Case DataErr
Case 3022:
' Dupli slog
MsgBox "Greska u unosu podataka broj: " & DataErr & ", opis:" & Application.AccessError(DataErr)
Response = acDataErrContinue
Case Else:
MsgBox "Neka greska u formi", vbCritical, "Paznja"
End Select
End Sub
Inače postoji tabela svih grešaka sa opisom na engleskom i ima 1600 slogova.
[Ovu poruku je menjao Getsbi dana 27.03.2008. u 23:04 GMT+1]