Results 1 to 6 of 6
  1. #1
    greich is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2009
    Posts
    3

    Mulitple Item Forms - Disabling Command button on certain records

    I have a command button on each record of a multiple item form. I need to disable the command button on some but not all records based on data on a field on that record. Is this possible?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    SURE! Just put code in the Current event of the form to check the value of the control and enable/disable the command button. Just make sure some other control has the focus because you can not disable a control with the focus.

  3. #3
    greich is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2009
    Posts
    3

    Not working quite like I expected.

    This isn't working quite like I thought it would. When I use code to make the command button not visible, it made all the command buttons invisible at the same time once I tabbed to the line that triggered the visible = False. Also, the OnCurrent only works when tabbing through the records. When the form refreshes or opens up, I would like to see the Command Button appear only on the lines where Status = "A". I tried the OnPaint also and

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I should have read your original post more carefully. It looks like you have a form in Continuous Form mode. As such, Conditional formatting does not work on Command Buttons. You also said disable and not make invisible. You can make sure the Command Button does not do anything if a control on that record contains certain data if you want.

  5. #5
    greich is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2009
    Posts
    3

    Thanks for your input.

    I currently have code that displays an error message when clicking on the command button on thosse records that I was hoping to disable or make invisible. I tested your solution using visible = false instead of disabling. I was hoping to avoid displaying the command button on those records that require no further action.

    Can you think of any other workaround? I might try making it a single form but have the form only .3" high to see if it will give the look of a continuious form. This should then allow me to make the command buttons visible or invisible. Don't know if this will even work but work trying just for kicks.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It looks like you are having a lot more success that I would in the same situation. That's great!

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

Similar Threads

  1. Replies: 12
    Last Post: 10-20-2014, 11:22 AM
  2. Command Button Help!
    By arthura in forum Programming
    Replies: 3
    Last Post: 06-30-2009, 12:55 PM
  3. Command button issue
    By sloppysly in forum Forms
    Replies: 8
    Last Post: 06-15-2009, 12:07 PM
  4. Duplicate command button
    By brettg in forum Database Design
    Replies: 1
    Last Post: 08-04-2008, 04:16 AM
  5. Command button code
    By lfolger in forum Forms
    Replies: 3
    Last Post: 03-25-2008, 04:26 PM

Tags for this Thread

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