A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Main Menu Form Will Not Open



 
 
Thread Tools Display Modes
  #31  
Old August 27th, 2009, 05:19 AM posted to microsoft.public.access.forms
Tom Wickerath
external usenet poster
 
Posts: 3,914
Default Main Menu Form Will Not Open

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.

Have you verified that your code compiles without any errors?

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, he

http://www.accessmvp.com/Strive4Peace/Index.htm


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

"Brent" wrote:

Hi Tom

Thanks for your input. At first it seemed that the office 11.0 reference was
not showing up but now I do have it. I did download the sample and I could
get it to open but I was not sure what to do with it.

Have you verified that your code compiles without any errors?

I have tried many things with the code, could you explain how this works?

Once again Thanks

  #32  
Old August 28th, 2009, 01:19 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Main Menu Form Will Not Open

Just post back to either tom's post or mine - we will all see it.

Now that you have that reference to the Microsoft Office 11 Object Library,
what happens when you try to open the database? If it opens and works
correctly it is fixed. Does it?

To comment out code, you put an apostrophe as the very first character at
the start of the line or lines of code.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia




"Brent" wrote in message
...
Jeanette

How do I comment out the code on the main form? I'm not sure if all the
forms have the same code I could check and post back.

I will post back to Tom under his post, I'm not sure if that is how it's
done or if I should post back under the last post.

Thanks again I can't believe you are still with this.

"Jeanette Cunningham" wrote:

As I understand, all your forms have this code in them. I would have
thought
that all your forms would have the same problem when you try to open
them.

If this was me, I would comment out the code on this main form that
doesn't
work and then open the form to see if it will open.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Brent" wrote in message
...
Thanks again Jeanette for all of your help. I am going to go back to
the
begining of these posts and redo everything you and others have
suggested
to
make sure I have not missed anything. If that doen't work I think I
will
be
at the end with this form and maybe try to recreate it.

Once again thanks for everything.

"Jeanette Cunningham" wrote:

Brent, I didn't look at the downloads. I understood that they were
examples.

Do this--
Open your database and open the code window.
You are using A2003 aren't you.
Go to Tools | References
and scroll down the list till you find
Microsoft Office 11 Object Library
Check the box next to this reference then close the references dialog.
Do a compile.
Hopefully it will compile and the main menu problem will be fixed.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia




"Brent" wrote in message
...
Jeanette

I got the downloads and opened them however, I'm not sure how they
work,
do
I copy some of the code into my code?

I can understand it you have had enough of this and want to move on.

thanks again for your help

"Jeanette Cunningham" wrote:

Here is some information from a colleague. He has a download that
explains
it.

CommandBarControl is a member of the Office object library. If the
code
uses
early binding, you will need a checked reference set to the
"Microsoft
Office {version} Object Library" (mso.dll). There is a downloadable
sample
available on the Seattle Access User's Group site:

A2003 uses version 11.


http://www.seattleaccess.org/downloads.htm

Quick Demo for Enabling Command UI, Zac Woodall, April 2005

Download (27 kb)

Adapted for '97 and 2000/2002, Tom Wickerath, May 2005

Download (51 kb)












 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.