Results 1 to 8 of 8
  1. #1
    I.A. is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    6

    disabling labels (or other controllers) in a continuous form

    Hi


    this is supposed to be fairly easy but I cant seem to get it to work...
    I have a continuous form with multiple rows from a query. The form "repeats" itself for every row.
    I wish to make the label called label1 invisible if the variable Type on the same row is equal to 2 and to apply this check for each row.

    I wrote a few lines:

    Code:
    If Me.Type = 2 Then
        Me.label1.Visible = False
    Endif
    but this doesnt seem to work. I've tried to put it under many different form events but cant get it to work.

    Any ideas?
    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The simplest way to get what you want is with Conditional Formatting (on the ribbon). I can't remember offhand if it works with labels, but if not you can get the same look with a textbox. The code solution you're trying will either check all rows or no rows. Code will work in a report in Preview or Print modes, but not in a form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    I.A. is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    6
    First of all thanks for the quick reply!

    I have to say this kinda sucks because I wanted it to work on some comboboxes as well .... anyway - good to know - wasted too much time on it as it is...

    I will try to see if I can make them merge in the background.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Conditional Formatting will also work with combo boxes. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    I.A. is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    6
    Thanks!
    It seems Conditional formatting cannot apply to labels.
    Is there a way through code to make the form more dynamic - I really don't want to leave empty fields when they are not needed. otherwise the only thing I can do is divide the table into 2 tables which seems excessive...

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Leaving fields empty implies a design problem. What do the fields in the table represent?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    I.A. is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    6
    I hope I can relay my intent....

    I have a primary table of products.

    A second table with possible actions - ActionList.

    The table the form is based on contains the instructions for manufacturing a specific product, hence the fields are:
    productID (linked to product table)
    ManufacturOrder
    ActionID (linked to ActionList)
    Instructions
    Ingredient

    The problem is that some actions do not require an ingredient so I wanted it not to appear. It must be a continuous form so the user can see all the actions and edit them or their order.

    Since your last post stated this is not possible I added some code lines to check that no one put it an ingredient with an action that doesnt require it and vice versa. I'm afraid any design change let me see all the actions together and in the right order.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That doesn't seem too bad. Like I said earlier, you can use a textbox instead of a label, and then use CF.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 11-23-2010, 10:16 PM
  2. Disabling textbox on reloading the form
    By accesscoder in forum Forms
    Replies: 3
    Last Post: 10-16-2010, 05:55 PM
  3. Replies: 1
    Last Post: 07-22-2010, 05:55 AM
  4. Replies: 0
    Last Post: 10-12-2009, 08:26 AM
  5. Continuous Form
    By duckie10 in forum Access
    Replies: 13
    Last Post: 06-09-2009, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums