Share via

Compile error setting Visible property

Anonymous
2018-05-04T13:59:51+00:00

I have a Form in Access.

On the "On Load Event", I have specified the following VB:   Me.STD_MAN_HOURS_REQD_TO_MAKE_PART.Visible = False

                                                                                                Me.Label59.Visible = False

On the Form, on the Before Update Event of the field [PART_NEEDS_FABRICATION_OR_MACHINING], I have specified the following VB:                  Me.STD_MAN_HOURS_REQD_TO_MAKE_PART.Visible = True

Me.Label59.Visible = True

None of this works, and when I try to open the form I get this message and get taken directly to the vb "Compile error, method or data Member not found"

I have used this code for Buttons before and it works for that.

Please help solve my problem!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2018-05-07T15:06:36+00:00

    Is the control itself -- the combo box or list box on the form -- named "Machine Name" or "Machine_Name"?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-05-05T10:37:50+00:00

    I was able to fix the problem with the help of some other persons comments regarding the compiling of the VB, to see the other errors in the VB preventing the Visible = true from working. Thanks for your help!

     in my VB is have this code       " Me.[Machine_Name].ListIndex <> -1"    when I compile, it stops here and says  Compile error "Method or data Member not Found" . The purpose of the -1 is to show no selection was made in the Combobox for [Machine Name].

    I do not know why, because it worked fine a few days ago, and the the Compile passes over the code just before it called "Me.DATE_OF_STANDARD1.ListIndex <> -1"

    The Rowsource for the Machine Name Field is: SELECT [6 - MACHINE_TYPES_AVAILABLE_FOR_MANUFACTURE].ID, [6 - MACHINE_TYPES_AVAILABLE_FOR_MANUFACTURE].MACHINE_NAME FROM [6 - MACHINE_TYPES_AVAILABLE_FOR_MANUFACTURE] ORDER BY [MACHINE_NAME];

    Do you have any Ideas on this?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2018-05-05T10:25:51+00:00

    You are a Star! Your help is Greatly Appreciated, and it worked.! I ended up with a couple of compile errors, which I could sort out, and now it works well.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2018-05-04T18:26:45+00:00

    When you get the error and it brings you to the VB window, it should be highlighting the name that it doesn't recognize.  What is highlighted?

    Was this answer helpful?

    0 comments No comments
  5. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2018-05-04T14:06:01+00:00

    In the VB editor, choose Debug > Compile, and fix any issues.

    Make sure you have Option Explicit at the top of every module, and set it as default under Tools > Options > Require variable declaration.

    If this label is associated with this textbox, you don't have to set visibility separately.

    Was this answer helpful?

    0 comments No comments