VBA code in Access 2007 help -- please

I've recently upgraded to Windows Vista, MS Office 2007. I am trying to write a program but running into troubles with the VBA code. Regardless of the database, or the code that I use, when I put it in as VBA, it doesn't run. When I use macros it works.

For example, if I create a button to exit the application, which the system auto codes for me as a macro which works. If I then convert to vb code, it doesn't work anymore.

I have setup a quick bit of code to see if it even goes to the vb code, but it never does. The code I've setup is similar to:

sub form_load()
msgbox "Hello", vbOKOnly, "Hello"
end sub

this should run regardless of anything else in the program, but doesn't.

Any help that can be offered would be greatly appreciated. Thank you in advance for the help.


  • I have continued to try and get this working. I haven't yet been sucessful.

    A new development though ... if I go in and create a new db, w/ no tables, forms, data, etc. I then create a blank form, that has the "Hello" msgbox come up. I then compile and save the form. When run, it works. However, when I save the db, exit, and go back in, the msgbox no longer comes up. Why would it be that I can open and work the form correctly once, but not over and over? This is only true w/ the msgbox, and other code doesn't work at all. I'm doing a basic if statement ... if a.value=true then b.visible=false end if.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion