VB code has no effect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ddtpmyra
    Contributor
    • Jun 2008
    • 333

    VB code has no effect

    Hi,

    I just started using MS Access 2007 and Im working on simple code on load event of my form (below) but these code does not take effect at all. Please educate me if there's some setting I need to make first.

    Private Sub Form_Load()
    Me.TxtName.Visi ble = False
    Me.txtPhone.Vis ible = False
    Me.TextLast.Vis ible = False
    Me.LblAreaCode. Visible = False
    Me.LblLast.Visi ble = False
    Me.LblName.Visi ble = False
    End Sub
  • Megalog
    Recognized Expert Contributor
    • Sep 2007
    • 378

    #2
    First place I would look is under the form's properties, specifically the Events.

    In design view, right click the form and choose 'Properties', if the window isnt already open.

    Go to the 'Event' tab, and be sure it says [Event Procedure] in the 'On Load' line.
    If not, then select the drop-down arrow in that field, and choose it.

    Save, and load the form.. should work fine!

    If this isnt the case, then maybe you have an On_Current event that is changing the visible values of those form objects after it loads.

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      In version 2007, the first question that needs asking when code doesn’t execute, has the folder holding the database been declared a “trusted” location? If not:

      To trust your folder, click:
      * Office Button (top left)
      * Access Options (bottom of dialog)
      * Trust Center (left)
      * Trust Center Settings (button)
      * Trusted Locations (left)
      * Add new location (button)

      Welcome to Bytes!

      Linq ;0)>

      Comment

      • Megalog
        Recognized Expert Contributor
        • Sep 2007
        • 378

        #4
        Originally posted by missinglinq
        In version 2007, the first question that needs asking when code doesn’t execute, has the folder holding the database been declared a “trusted” location? If not:

        To trust your folder, click:
        * Office Button (top left)
        * Access Options (bottom of dialog)
        * Trust Center (left)
        * Trust Center Settings (button)
        * Trusted Locations (left)
        * Add new location (button)

        Welcome to Bytes!

        Linq ;0)>
        Ooooh that's probably it.. I disabled that so long ago I forget it even exists ;)

        Comment

        • ddtpmyra
          Contributor
          • Jun 2008
          • 333

          #5
          It Works!
          Great! Thanks you so much!

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Glad we could help!

            Linq ;0)>

            Comment

            Working...