Results 1 to 3 of 3
  1. #1
    jamesgtierney is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    1

    error message 3022

    Hi


    I wish someone could help me
    I have a simple form in my access database for a hairdressing salon
    when i place an appointment i have a piece of simple code to replace error message 3022

    here is the code


    Option Compare Database


    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    If DataErr = 3022 Then
    MsgBox ("This appointment has already been booked")
    Response = 0
    End If
    End Sub

    it works when I add a new appointment but i need to add nav buttons
    but when i add them the custom message doesnt work.
    can anyone help me.

    James

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    cross posted http://www.access-programmers.co.uk/...d.php?t=284350

    James,

    It's OK to cross post, just tell readers you have done so.

    Here's why.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Looking at the cross post, you're creating problems, I think, by trying to add a custom error message to your 'add record' button code! Once the custom error message is handled in the Form_Error event, as you've done, it will always display this message for Error 3022, regardless of what event triggers the error! To repeat...your code only needs to be in the Form_Error event.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run Time Error 3022...
    By BusDriver3 in forum Access
    Replies: 7
    Last Post: 10-23-2015, 04:17 PM
  2. Error Handeling for a 3201 and 3022 Error
    By starlancer805 in forum Access
    Replies: 3
    Last Post: 03-11-2015, 12:46 PM
  3. The Error 3022 Duplicate Problem
    By boywonder381 in forum Programming
    Replies: 21
    Last Post: 09-01-2014, 11:27 PM
  4. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  5. Replies: 4
    Last Post: 02-13-2013, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums