Results 1 to 5 of 5
  1. #1
    blacksaibot is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    34

    Can't get any of my code to execute!

    I'm simply trying to make a message box display when a user clicks on a button.



    I go to the "On Click" section in the properties sheet.
    I select Code Builder

    I simply put msgbox("This is a test")

    I save it

    I open the form, I click the botton and NOTHING happens
    What am I missing here?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    are you saving the code? save the form, the code, and make sure there is something in the event line of the properties window. like "[event procedure]"

    also, I don't believe () are needed when you are manually entering a string in the code for the message. simply put:
    Code:
    msgbox "my message" 

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Make sure the database is in a Trusted Location (Office Button/Access Options/Trust Center) or that code has been explicitly enabled. Otherwise, no code will run.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    blacksaibot is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    34
    Nevermind I got it to work. It was the trust center. Thank you!


    Quote Originally Posted by ajetrumpet View Post
    are you saving the code? save the form, the code, and make sure there is something in the event line of the properties window. like "[event procedure]"

    also, I don't believe () are needed when you are manually entering a string in the code for the message. simply put:
    Code:
    msgbox "my message" 
    Yeah I save the code and the form, and the event line of the properties does have that in there. I got rid of the parentheses and it still didn't execute.

    Quote Originally Posted by pbaldy View Post
    Make sure the database is in a Trusted Location (Office Button/Access Options/Trust Center) or that code has been explicitly enabled. Otherwise, no code will run.
    How do I "explicitly" enable it?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo, glad you got it sorted out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 02-16-2010, 10:43 PM
  2. Can a report execute generate a file
    By techexpressinc in forum Reports
    Replies: 7
    Last Post: 01-16-2010, 04:03 AM
  3. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  4. Help with VBA Code
    By access.newby in forum Forms
    Replies: 1
    Last Post: 11-15-2009, 05:43 AM
  5. Execute Command Interactively
    By zephaneas in forum Programming
    Replies: 1
    Last Post: 11-08-2008, 09:56 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