none
VBA code causing Multipage control to lose customizations? (Access 2007) RRS feed

  • Question

  • Hi all,

    I've come across a very strange bug that I've never experienced before when using the MS Forms 2.0 MultiPage control.

    I'm using Access 2007, and am setting up a form with a MultiPage control. 

    1) I add/rename a few pages in Design mode (see image below):

    2) I then switch to Form View:

    My MultiPage control stays as intended, even when toggling back and forth between Design View and Form View.  But....

    3) If I run (any) code on the Form_Load event...:

    4) ...when I switch back to Design Mode, all saved customizations from step 1 above are lost, and the MultiPage is back to its default values (and a smaller size).

    I've used Multipage controls in previous projects, and I don't recall ever running into anything like this before (although those projects were done using Excel, not Access).  Anyone have any ideas what's going on?


    -- Greg Williams West Linn Public Library



    • Edited by wlpl_greg Monday, March 19, 2012 10:27 PM
    Monday, March 19, 2012 10:20 PM

Answers

  • Ah, I can't reproduce your scenario using the Multi Page ActiveX Control. When saving it doesn't change, or went back to the original default settings.

    With that said, I will highly recommend using the Tab Control instead.

    When you have WebBrowser control showing up in all of the Pages, that means that you placed it in the TabControl itself rather then the Page.

    Make sure when you drop the WebBrowser control the Page is highlighted.

    See below thread for more info on how to use the Tab Control in Access 2007:

    http://office.microsoft.com/en-us/access-help/create-a-tabbed-form-HA010277613.aspx

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"

    Please vote an answer helpful if they helped. Please mark an answer as an answer when your question is being answered.

    Monday, March 19, 2012 11:16 PM
    Moderator

All replies

  • Hi Greg,

    I would save the Form first, then applying some other code etc.

    Also I would personally recommend using the build-in Tab Control rather then the ActiveX Object, as you need references set to Microsoft Forms 2.0 Object as with the Tab Control, you won't need to set a reference.

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"

    Please vote an answer helpful if they helped. Please mark an answer as an answer when your question is being answered.

    Monday, March 19, 2012 10:43 PM
    Moderator
  • Hi Daniel,

    Thanks for the response.  Unfortunately, saving the form before opening teh form/running the code doesn't seem to help.  I get the same behavior.

    Funny you should mention TabControls.  I originally was using one, but I've been having trouble putting two separate WebBrowser controls on two separate TabControl tabs (sometimes, one WebBrowser shows up on all the TabControl pages, while at other times, both WebBrowser controls show up at runtime superimposed on the same tab, even though I originally placed them on different tabs in design mode).  I was hoping to avoid *that* issue by using a MultiPage, but I just traded one problem for another!

    I guess I'll go back to a TabControl, and see if I can't get the WebBrowsers to behave.  I may be posting back to the forums again soon if I can't resolve it on my own!  :-)

    -GW


    -- Greg Williams West Linn Public Library

    Monday, March 19, 2012 11:10 PM
  • Ah, I can't reproduce your scenario using the Multi Page ActiveX Control. When saving it doesn't change, or went back to the original default settings.

    With that said, I will highly recommend using the Tab Control instead.

    When you have WebBrowser control showing up in all of the Pages, that means that you placed it in the TabControl itself rather then the Page.

    Make sure when you drop the WebBrowser control the Page is highlighted.

    See below thread for more info on how to use the Tab Control in Access 2007:

    http://office.microsoft.com/en-us/access-help/create-a-tabbed-form-HA010277613.aspx

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"

    Please vote an answer helpful if they helped. Please mark an answer as an answer when your question is being answered.

    Monday, March 19, 2012 11:16 PM
    Moderator