Форумы HiProg.com - MS ACCESS, VBA, VB

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

ник: Lukas
У класса форма есть событие Error, там и подменяем текст сообщения.
Пример от Гетца & Co:

' From Access 2002 Desktop Developer's Handbook
' by Litwin, Getz, and Gunderloy (Sybex)
' Copyright 2001.  All rights reserved.

Private Sub Form_Error( _
 DataErr As Integer, Response As Integer)

    Const adhcErrDataValidation = 3317
    Const adhcErrDataType = 2113
    Const adhcErrDuplicateKey = 3022
    Const adhcErrNullKey = 3058

    Dim strMsg As String
    Select Case DataErr
        Case adhcErrDataValidation, adhcErrDataType
            strMsg = "The data you entered does not " & _
             "fit the requirements for this field."
            strMsg = strMsg & vbCrLf & "Please try again, " & _
             "or press Escape to undo your entry."
            MsgBox strMsg, vbExclamation
            Response = acDataErrContinue
        
        Case adhcErrDuplicateKey
            strMsg = "You've attempted to add a record " & _
             "that duplicates an existing key value."
            strMsg = strMsg & vbCrLf & "Please try again, " & _
             "or press Escape to undo your entry."
            MsgBox strMsg, vbExclamation
            Response = acDataErrContinue
        
        Case adhcErrNullKey
            strMsg = "You've attempted to add a new " & _
             "record with an empty key value."
            strMsg = strMsg & vbCrLf & "Please supply " & _
             "a key value, or press Escape to undo your entry."
            MsgBox strMsg, vbExclamation
            Response = acDataErrContinue
            ' You can even place them on the right field!
            txtLastName.SetFocus
        
        Case Else
            ' It's an unexpected error.  Let Access handle it.
            Response = acDataErrDisplay
    End Select
End Sub


Ваше имя:

Пароль:

Цитировать: [quote][/quote] Код: [code][/code]
Жирный: [b][/b] Наклонный: [i][/i]
URL: [url][/url] 

Сообщение:

 Размер файла не более 50 Кбт. Большие файлы можно размещать на www.slil.ru

Прикрепить:

 

Для вставки смайлов в текст щелкните по значку.