Results 1 to 5 of 5
  1. #1
    Mtyetti is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    8

    MsgBox


    I having great difficulty writing code for a MsgBox function in Access2007. I have created a simple button with a simple 'on click' event of:

    Private Sub Command1_Click()
    MsgBox "test"
    End Sub

    When I use this option in a blank database (database with just one dummy form), it works fine.

    When I try to use this in my active database, the button consistently does nothing when clicked.

    I am new to these forums and am very eager to see if anyone has had a similar problem. Thank you so much!

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Is your active database in a Trusted Location?

    See here for more about that:
    http://www.btabdevelopment.com/ts/de...aspx?PageId=13

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Private Sub Command1_Click()
    MsgBox "test"
    End Sub

    The part I've bolded must correspond to your actual button name. If your button is not named command1 nothing will happen. The only time I've seen this happen is when someone changes a button name and doesn't go and change the 'on click' event to match the command button name.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272

    Thumbs up

    Quote Originally Posted by rpeare View Post
    Private Sub Command1_Click()
    MsgBox "test"
    End Sub

    The part I've bolded must correspond to your actual button name. If your button is not named command1 nothing will happen. The only time I've seen this happen is when someone changes a button name and doesn't go and change the 'on click' event to match the command button name.
    Definitely a common problem. Good one.

  5. #5
    Mtyetti is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    8
    Bingo! It had to do with the 'trusted location'. Thank you so much!
    I do know what you are saying about the name matching. 'Command1' is the actual button.
    I am trying to create some more complex password protected forms, but couldn't get the buttons to work at all. I think adding the trusted location should do the trick though.

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

Similar Threads

  1. Msgbox with data in
    By AndycompanyZ in forum Programming
    Replies: 9
    Last Post: 06-27-2011, 07:52 AM
  2. MsgBox with a password option?!!
    By avworx in forum Programming
    Replies: 8
    Last Post: 05-23-2011, 06:52 PM
  3. MsgBox Placement
    By tpcervelo in forum Programming
    Replies: 2
    Last Post: 12-27-2010, 07:36 AM
  4. Custom MsgBox
    By roccoIT in forum Programming
    Replies: 3
    Last Post: 07-06-2010, 10:43 AM
  5. Yes No Cancel MsgBox
    By Rick West in forum Forms
    Replies: 5
    Last Post: 04-14-2010, 08:57 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