Results 1 to 4 of 4
  1. #1
    rossi45 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    12

    Allow Additions Msg Box

    Hi all.

    I have set my form to 'No' for Allow Additions. (i.e. I do not want the user to add new records to the table)



    When I get to the last record and try to click the 'Next Record' button, a message box appears:

    Click image for larger version. 

Name:	msgbox.jpg 
Views:	7 
Size:	13.7 KB 
ID:	7336

    I do not like the text string used in this box. Is there anyway to change it? I tried to go to the event to see if it is set there, but it just calls the:

    Code:
    MsgBox Err.Description
    It looks like there's a default message that gets called. I'm wondering if this can be altered.

    Thanks,
    Mike

  2. #2
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Try adding the below code. The "Chr$(10)" are line breaks.

    Code:
    Private Sub ErrMsg()
        Dim x As Variant
        x = MsgBox("Enter the text you want to be read here" & Chr$(10) & Chr$(10) & "Please check the data entry and re-submit.", , "Title for window")
    End Sub

  3. #3
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Are you using your own code for that button, or you using the navigation bar at the bottom of the form? If you are using the navigation bar, and the form has Allow Additions = No, then you shouldn't be getting an error message at all.

    In answer to your question, you can easily change the text. Instead of err.description in the msgbox line, just replace err.description with whatever text you want to use.

    Two useful properties of the err object are err.number and err.description, which you saw. err.number is useful if you want to take different actions depending on what error has occurred, for example using Select Case err.number ....

    HTH

    John

  4. #4
    rossi45 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    12
    Thanks TG_W. That's what I needed!

    Mike

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

Similar Threads

  1. Allow additions on .accdr
    By dougie in forum Forms
    Replies: 0
    Last Post: 02-20-2012, 05:17 AM
  2. Multi-record additions using a list box not working right
    By avarusbrightfyre in forum Programming
    Replies: 3
    Last Post: 10-27-2010, 01:50 PM

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