Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / December 2007

Tip: Looking for answers? Try searching our database.

Custom menu: action is not trigger

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Magnolia - 13 Dec 2007 18:12 GMT
Hi,
For the first time I am developping an Access application with a
custom toolbar (menu) at the top. I have found various posting or web
sites where people explain how to do the setup. In fact, I have
followed the instructions coming from this web site.
http://www.jamiessoftware.tk/articles/menubars.html

When my application opens, I can see my custom menu at the top of the
form. My problem is the following: when I click on an item in the
menu, nothing happen !!! I have double-ckeck and I have really
associated an action to the menu item. In fact I have tried to
associate the menu item to a macro. And I have also tried to associate
it to a function inside my Module.

Please I need help !!! I can't see what am I doing wrong.

I don't know if it can help but I found strange that if I click on the
right mouse button, I can a menu with the following elements:
- Form View
- Formating (is checked)
- Web
- Customize ...
Albert D. Kallal - 13 Dec 2007 19:43 GMT
I would say that 90% of my custom menu bars call, and run my VBA code.

All you need to do is make the code (a function) public, and then simply
place the function name in the buttons on-action event code.

Further, likely often you will have specific code to a particular form, and
once again, you simply declare those functions (in that form) as public.

The syntax to call the code then is:

=YourFunctionName()

Often, (if not most of the time), you code you call will need to pick up
some information about he current screen etc. So, my code most of the time
starts out, and grabs the current screen name. I use:

Public Function AskInvoicePrint()

  Dim tblgroupid    As Long
  Dim frmActive     As Form

  Set frmActive = Screen.ActiveForm

  tblgroupid = frmActive.frmMainClientB.Form!ID

  If frmActive.InvoiceNumber = 0 Then
     frmActive.InvoiceNumber = nextinvoice
     frmActive.Refresh
  End If

  DoCmd.OpenForm "guiInvoicePrint", , , "id = " & tblgroupid

End Function

The above is code that the invoice print button runs. note how I right away
pick up the active form. After that, I can easily ref the forms object as if
the code was running much like the code would if put behind a button on the
form. In the above example, I also check if a invoice xnumber has been
generated before printing. And, the Refresh forces a disk write if in fact I
do change the invoice number. And, in addition the above clip also passes
the currently selected sub-form item that the invoice print form needs.

Also, if the code you write is for the particular form, then as mentioned,
you can simply place the code into the forms module code. There is no need
to pick up the active screen...and you can use me. as you
always used.

If you want to see some sample menu bars, and why I use them, you can read
the following:

http://www.members.shaw.ca/AlbertKallal/Articles/UseAbility/UserFriendly.htm

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.