Hi Brent,
Thanks for your input. At first it seemed that the office 11.0 reference was
not showing up but now I do have it.
If you did not have this reference checked before, that would have been a
guaranteed compile-time error, as you reported earlier:
Public Function CMD_EnableCommandBarCtl
(pcbr As CommandBar, pstrTag As String, fEnable As Boolean) As Boolean
Compile error user-defined type not defined
I did download the sample and I could get it to open but I was not sure
what to do with it.
The point of that sample was to run it on your PC. It should work correctly,
without throwing any run-time errors. It includes the same type of code that
is causing you a problem in your application. So, if you received an error
with that sample, it would indicate some other problem that is unique to your
computer, but not to the .mdb file itself.
I have tried many things with the code, could you explain how this works?
Sure. Open any code module (it doesn't matter which one). Then, click on:
Debug | Compile {ProjectName}
where {ProjectName} is the name of your VBA project. You should not receive
any compile-time errors when you do this; the action should just be silent.
If you immediately go back in and click on the same sequence, without making
any changes at all to your code (including even hitting a space bar), then
you should see that this option is disabled (ie. "greyed out"). That's
exactly what you want to see.
There are two general types of VBA errors: compile-time errors and run-time
errors. If you can successfully compile your VBA code, then you've eliminated
the possibility of any compile-time errors. That doesn't mean that you are
out of the woods yet, as you may still receive a run-time error. For example,
dividing any number by zero will result in a run-time error, since division
by zero is undefined, even though such code will compile just fine.
Access MVP Crystal has a great tutorial available for you to get your feet
wet learning VBA. Check it out, here:
http://www.accessmvp.com/Strive4Peace/Index.htm
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________