2007 Form Created 2003 Macros Not Working

L

LindaSD

I have 4 Access databases created in 2003 (not by me) that when I open in
2007 and try to use a command button, the macros behind it are not running.
In fact when I review the design of the button, it has OnClick vb attached
with nothing in the vb except error checking. All these buttons are used
while in one record on a form to navigate to another record using a drop down
list. The error is 0. The button should be attached to a macro and don't
see why it is not, and have tried to redo the marcos and it still won't work.
So far I've had to completely rebuild the search in one database when I see
this doesn't work in all of them.

Why is opening the databases in 2007 doing this? They all worked before.
Any help is appreciated. My solution today is to go to someone with 2003 and
open one of these and see what happens there. Linda
 
L

LindaSD

More research shows there is vb code on the button - OnClick and AfterUpdate.
I opened the form in 2003 and the button works like it should, but not in
2007. The update in the form is not getting performed. Is there something
in 2003 vb that 2007 can't do. Below is the vb for the button. Linda

Private Sub Command2_Click()
On Error GoTo Command2_Click_Err

DoCmd.OpenForm "Master List", acNormal, "", "[Master List]![Document
ID#]=[Forms]![Find Document box]![Find docCombo]", acEdit, acNormal
DoCmd.Close acForm, "Find Document box"

Command2_Click_Exit:
Exit Sub

Command2_Click_Err:
MsgBox Error$
Resume Command2_Click_Exit

End Sub

Private Sub Find_docCombo_AfterUpdate()

DoCmd.OpenForm "Master List", acNormal, "", "[Master List]![Document
ID#]=[Forms]![Find Document box]![Find docCombo]", acEdit, acNormal
DoCmd.Close acForm, "Find Document box"
End Sub
 
D

Dirk Goldgar

LindaSD said:
I have 4 Access databases created in 2003 (not by me) that when I open in
2007 and try to use a command button, the macros behind it are not
running.
In fact when I review the design of the button, it has OnClick vb attached
with nothing in the vb except error checking. All these buttons are used
while in one record on a form to navigate to another record using a drop
down
list. The error is 0. The button should be attached to a macro and don't
see why it is not, and have tried to redo the marcos and it still won't
work.
So far I've had to completely rebuild the search in one database when I
see
this doesn't work in all of them.

Why is opening the databases in 2007 doing this? They all worked before.
Any help is appreciated. My solution today is to go to someone with 2003
and
open one of these and see what happens there. Linda


Quite possibly, Access 2007 is disabling VBA in your database. That's its
default behavior, unless you use the Trust Center settings to designate a
trusted location and put your database in that location.
 
L

LindaSD

The Trust Center is set up correctly and the allow macros is working. My IT
dept walked through this and the vb code is running ok. When I try to step
through the code I immediately get a macro window stating macro can't be
found. I don't see anything that was in the vb that should cause this. What
else?
 
D

Dirk Goldgar

LindaSD said:
The Trust Center is set up correctly and the allow macros is working. My
IT
dept walked through this and the vb code is running ok. When I try to
step
through the code I immediately get a macro window stating macro can't be
found. I don't see anything that was in the vb that should cause this.
What
else?


You can't just step into an event procedure, if that's what you're trying to
do. Even if it's a public procedure, which by default they aren't, you need
to create an instance of the object (form) and call it with reference to
that instance. To debug an event procedure, the easiest way is to set a
breakpoint in the procedure, open the form, and then trigger the event in
the usual way. Then, once execution stops at the breakpoint, you can
single-step through the code as you normally would.
 
L

LindaSD

Thank you for the info. I did not create the 60 some dbs that we are using.
I have changed the Trust Center settings and have changed the Macros to allow
all. My IT department checked what I did and see nothing else we can do. I
did not build the code so do not even know what else to check. It is still
not allowing this simple code to run. I am telling users to just close the
form and reopen it from the switchboard rather than trying to use the button
to switch (where the code is not working). This is happening in every db
that we have. The code is a simple OnClick and AfterUpdate changing the form
to the filtered record selected. The only way I got one database to work was
completely rebuild the form and use macros and not vb. I have yet to get a
response as to why the vb is not running, excpept the trust center settings.
Another issue was that in the Trust Center I had to manually type in the
complete url....browsing through the network (which usally gets this done
right) would not work and kept reverting back to my mapped network drive even
though I worked through the full network path. I can't imaging having to go
through this on everyone's computer throughout a 1,000+ employees that use
the databases. If this is new to 2007, it can't be just me having these
issues. More help is appreciated. In a grand funk over this 2007 change and
hoping it gets better (three weeks into it and not improving). Linda
 
L

LindaSD

I had IT check the permissions on changing the Trust Center and everything
allows me to do it correctly. I downloaded the test database that ran
perfect with nothing coming up as "not trusted". I have even followed
instructions on checking database references for "missing" and nothing is
showing missing. Why is something so simple working in 2003 and not in 2007
after all this? I finally give up and change how the code runs the change in
form. It seems that after selecting from the drop down and passing the focus
to the main form to change to that record is what is failing so I just have
the code close the main form and reopen it with the new record request. I
took a look at some of the sample databases on MS site and they all seem to
use macros instead of vb. If you have any other suggestions, it still
concerns me that the code runs in 2003 but not 2007. Thanks for all your
help. Linda
 
D

Dirk Goldgar

LindaSD said:
I had IT check the permissions on changing the Trust Center and everything
allows me to do it correctly. I downloaded the test database that ran
perfect with nothing coming up as "not trusted". I have even followed
instructions on checking database references for "missing" and nothing is
showing missing. Why is something so simple working in 2003 and not in
2007
after all this? I finally give up and change how the code runs the change
in
form. It seems that after selecting from the drop down and passing the
focus
to the main form to change to that record is what is failing so I just
have
the code close the main form and reopen it with the new record request. I
took a look at some of the sample databases on MS site and they all seem
to
use macros instead of vb. If you have any other suggestions, it still
concerns me that the code runs in 2003 but not 2007. Thanks for all your
help.


At this point, I'm at a loss to say what's going on. I thought you said
that no VBA code would run, but now I get the impression that *some* VBA
code is able to run. Is that right? I would expect the A2007 sample
databases to run, regardless, because they are built using only macros.

If you create a new database, create a form, add a command button to the
form, put some VBA code into the button's Click event, and click that
button, does it run?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top