View Single Post
  #24  
Old August 19th, 2009, 03:49 AM posted to microsoft.public.access.forms
Brent
external usenet poster
 
Posts: 143
Default Main Menu Form Will Not Open

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)



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Brent" wrote in message
...
Here it is

Dim ctl As CommandBarControl

On Error GoTo Err_CMD_EnableCommandBarCtl
Call RecordTrace("basCmdFunctions", "CMD_EnableCommandBarCtl",
pcbr.Name)
CMD_EnableCommandBarCtl = False

Set ctl = pcbr.FindControl(msoControlButton, Tag:=pstrTag,
Visible:=True, Recursive:=True)
ctl.Enabled = fEnable

CMD_EnableCommandBarCtl = True

Exit_CMD_EnableCommandBarCtl:
Exit Function

Err_CMD_EnableCommandBarCtl:
Select Case Err
Case 91 'Control doesn't exist
CMD_EnableCommandBarCtl = True
Case Else
Call GlobalError("basCmdFunctions" &
".CMD_EnableCommandBarCtl")
End Select
Resume Exit_CMD_EnableCommandBarCtl

End Function

"Jeanette Cunningham" wrote:

Post the code for this function
Public Function CMD_EnableCommandBarCtl(pcbr As CommandBar, pstrTag As
String, fEnable As Boolean) As Boolean



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



"Brent" wrote in message
...

Jeannette

Here is the first place the code stoped at I pressed F8

Public Function CMD_EnableCommandBarCtl(pcbr As CommandBar, pstrTag As
String, fEnable As Boolean) As Boolean

Compile error user-defined type not defined

I can not proceed pass this line.

Thanks



"Jeanette Cunningham" wrote:

Here are the steps to debug this code:
Find the line Call RecordTrace("basApplFunctions",
"APPL_StartApplication")
and click in the very far left margin for this line to set a break
point -
when it is set you will see the whole line coloured red.
Save and close the code window.
Close the startup form if it is open.
Now open the startup form.
The code will stop at the break point you set.
Now press F8 to step through the code.


Post back with results.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Brent" wrote in message
...
Hi Jeanette

Here is the code where the yellow highlight starts, I just found it.
Do
you
see anything in the code that is causing the problem? It looks to me
like
there might be something here as it tells to stop application if
!!!!
The
form is in the startup

Public Function APPL_StartApplication() As Boolean

Dim fldEntityName As Field
Dim fldEntityPath As Field
Dim intI As Integer
Dim lngNumDatabases As Long
Dim qdfEntity As QueryDef
Dim rstEntity As Recordset
Dim strMsg As String

On Error GoTo Err_APPL_StartApplication
Call RecordTrace("basApplFunctions", "APPL_StartApplication")
APPL_StartApplication = False

TryRelink:
Set rstEntity = Nothing
If CMD_GetVersion() "8.0" Then
strMsg = gconSystemTitle & " must be run with Microsoft
Access
97
or
later"
MsgBox strMsg, vbOKOnly + vbCritical, gconSystemTitle
Application.Quit A_EXIT
End If

Set gwrk = DBEngine.Workspaces(0)
Set gdb = CurrentDb

Set qdfEntity = gdb.QueryDefs("qselEntityDatabases")
Set rstEntity = qdfEntity.OpenRecordset
With rstEntity
.MoveLast
.MoveFirst
lngNumDatabases = .RecordCount
Set fldEntityName = .Fields("EntityName")
Set fldEntityPath = .Fields("EntityPath")
End With
ReDim gdbLinked(1 To lngNumDatabases)
intI = 0
With rstEntity
.MoveFirst
Do While Not .EOF
intI = intI + 1
Set gdbLinked(intI) = DBEngine.OpenDatabase(fldEntityPath
&
"\"
& fldEntityName)
.MoveNext
Loop
.Close
End With

'Set startup properties of database
If CMD_IsItMDE(CurrentDb) Then
Call CMD_SetStartupProperties
End If

APPL_StartApplication = True

Exit_APPL_StartApplication:
Exit Function

Err_APPL_StartApplication:
Select Case Err.Number
Case 3044, 3051, 3043
MBX_Ok "Unable to open the database " & fldEntityPath &
"\"
&
fldEntityName
If Not CMD_OpenForm("frmEntitymaintenance",
plngWindowMode:=acDialog) Then Resume Exit_APPL_StartApplication
Resume TryRelink
Case 10001 'Error in called procedure
Case Else
Call GlobalError("basApplFunctions" &
".APPL_StartApplication")
End Select
Resume Exit_APPL_StartApplication

End Function

Thanks again for all your help





"Jeanette Cunningham" wrote:

There are 3 references you need for A2003
Visual basic for applications
Microsoft Access 11.0 Object Library
Microsoft DAO 3.6 Object Library

When you imported all the objects, you may have ommitted the menus.
Go back to the import screen and under options select Menus and
Toolbars.
Don't select any tables, queries etc, just the menus and toolbars.
See if this fixes the problem.

What is the name of the form that should open when the database
opens?
Have you put this form as the startup form in the database options
|
Tools |
Startup
Display Form/Page:


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Brent" wrote in message
...
Hi Jeanette

Sorry for not getting back sooner but work got in the way.

Now that I have converted the database what should the new
references
be?
it
looks like I still have the same old ones.

I now get this new error message

Microsoft can not find the macro "mnuMain" the macro groups don't
exist
or
it is new and has not been saved, then it talks about the
macorgroup
that
was
saved
I must specify the same macroname in the argument???

Any ideas on this?




"Jeanette Cunningham" wrote:

Option Explicit
Option Compare Database

should be in the order

Option Compare Database
Option Explicit


-------------------------
macros - that's fine. You have checked for macros and there are
no
macros.
That is one less thing to check for errors.

----------------------

About converting to A2003
One easy way that I do conversions is to create a new blank
database
in
the
newer version and be sure to set 'Track Name Auto correct' to
No.
So create a new blank database in A2003, go to Tools | Options |
General
tab
and set Track name autocorrect to no.

Do you have linked tables?
If you do, use the new blank database you just created and
import
the
tables
into it (don't link them).