Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2006
    Posts
    111

    Unanswered: Where's the code that executes when I press a toolbar button?

    You may remember me - I'm working on an Access project for a customer and the programmers who developed/maintained it prior to me are no longer with us (RIP!)

    I am looking for this in the Help file, but maybe an answer here would be quicker. I am creating a new form much like an existing form. The existing form has a toolbar. It has a Delete button to delete a database record and I need to see this code so I can replicate it in my new form, but where is it?

    If I go to the form's properties, I see its Toolbar property is set to something called Forms. If I click on the Toolbar property's drop down options, it lists Forms, Reports, SBI and Search. I assume these are custom toolbars someone created.

    If I go to Tools->Customize and pick the Toolbars tab, these four toolbars are there (among many others). So what? Clicking Forms doesn't allow me to see anything useful about it.

    Can someone help me find my toolbar code???

    Thanks!

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    here's the way it goes for me with menus
    (i don't use toolbars, but i suppose menus are not that different)
    my menus run code in a module
    to see what code..

    View/Toolbars/Customize
    tab:Toolbars and tick the toolbar of interest ...it is on screen.

    right-click a menu entry and choose properties (see gif below)
    search the app for that routine.

    NB some folk use menus to run macros - i dont use macros at all so have no idea how you would find one if you knew its name.

    izy
    Last edited by izyrider; 02-05-08 at 14:25.
    currently using SS 2008R2

  3. #3
    Join Date
    Jul 2006
    Posts
    111
    Thanks for the response (I thought this would be easy for Access veterans - why so few responses???), however...

    "search the app for that routine" - what routine? When I said in my original post, "If I go to Tools->Customize and pick the Toolbars tab, these four toolbars are there (among many others). So what? Clicking Forms doesn't allow me to see anything useful about it" what I was trying to ask for help with was where on this screen is anything about a routine or code? All mine says is Toolbar Name, Type, Docking then some checkboxes.

    Microsoft Onlinelp is not helping! So please if you can help me by providing additional information, I'd appreciate it. Thanks again.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    why so few responses???
    - what is left to say after i've given you the right answer?

    what's with all this clicking forms stuff?

    Toolbar Name, Type, Docking are properties of the menu/toolbar (and menus/toolbars don't run code - individual items in the menu/toolbar run code/macro)

    have another read what i said.

    get one of the wretched toolbars on the screen with the customise dialog open.

    if at all possible, resist the temptation to rush around clicking forms and instead right-click a button on the toolbar, choose properties from the dropdown context menu, look in the on action box: that is what happens when the button is clicked.

    ...look at the picture i posted.

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Jul 2006
    Posts
    111
    When I said "Clicking Forms..." - Forms is the name of the toolbar (sorry, these are not my names, I would never have given a toolbar a name that can so easily be confused with other objects). I was clicking the name of the toolbar I want to examine.

    I apologize for not looking at the picture you so kindly went to the trouble of including. I did not know I could click on it to enlarge it. Now that I see it, I agree this would be very useful. How do I get to it?

    When I right-click a button on the toolbar (this would be while running, because I don't know of a way to see the toolbar otherwise) I get a list that says Task Pane, Web, Forms, Reports, SBI, Search then Customize... (Forms is checked in that list). This Customize dialog has three tabs - Toolbars, Commands and Options. If I go to Forms and say Properties - this is what seems useless to me, for my purposes.

    Thank you. I appreciate your patience walking me through this.

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    aha.
    you must not be running.
    then View/Toolbars/Customize and the Toolbars tab.
    then check the checkbox for the toolbar you want to play with (it comes on screen when you check the box)
    then right-click any one of the items in the toolbar
    (you can get to the other items from the top combo you can see in the below picture)

    izy
    Last edited by izyrider; 02-05-08 at 14:25.
    currently using SS 2008R2

  7. #7
    Join Date
    Jul 2006
    Posts
    111
    Thank you! I'm finally able to follow along.

    However (isn't there always a "but"?!), On Action: is blank. What does this mean? The toolbar button saves a record. There must be some customized code somewhere that only knows how to save a record to my database, right? Or can this be a generic operation?

    Begin a Group is checked. I don't know what that means, or if it's relevant.

    Thanks.

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    sorry no great insights - i use only my own code in custom menus.

    an observation tho:
    if you do the same exercise on a standard menu, the On Action is blank

    so an exercise for you:
    make a custom menu/toolbar and drag in the standard Save or whatever from the customize dialog (is it blank On Action ??)

    ...is the probem as simple as that? just use the standard Save command (but in a custom menu)??

    this might explain why you have not found the menu code by wandering around in the application.

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i missed the begin group comment.
    - this just draws a cosmetic line separating two groups of related controls on the menu/toolbar. tough to describe, but you know what i mean - anyhow it is cosmetic only.

    izy
    currently using SS 2008R2

  10. #10
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    last from me on this:

    some deviants build menus/toolbars in code - normaly you would have spotted this browsing around in the code.

    some deviants^2 build menus/toolbars in code from hidden modules: worth a two second diversion to Tools/Options/View and show hidden & system objects and see what you see. don't mess with any of the tables Msysxxxxxx but look for stuff called usysxxxxxxx

    best of luck with it. izy
    currently using SS 2008R2

  11. #11
    Join Date
    Jul 2006
    Posts
    111
    Thank you for all your help.

    I wanted to know more about this ahead of time, because I had to give my customer a time estimate for this task (and others) and I wanted to see the code to have a better idea. I will proceed and when I actually get to that point, you may hear from me again. But your insight did tell me a lot and I will try what you said (about creating a custom menu that runs a standard action...) I will try all this in a day or two.

    Thanks very much. You've been very helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •