none
Error while try to set enable or visible property of button RRS feed

  • Question

  • Hi,

    In a Access 2013 Web App I try to set the enable or visible property of custom buttons in the actionbar or button in a row in a data sheet view (used as a sub view) on the On Current event.

    On all methodes (set False/True or Yes/No or 0/-1) I get the same error (Not a valid property for this control, 3270).

    Btw, when I set value on 0 or -1 the designer translates this in False and True

    For now I'm thinking in the direction of the language I use (Dutch) in both desktop and office. I will try this on a English language machine...

    Any thoughts?

    Thanks

    Monday, August 17, 2015 10:55 AM

Answers

  • Good Morning Paul,

    As I mentioned in an earlier post, I don't think it is possible. See the quote from the following thread...

    "Keep in mind that this technique won't work for datasheet views but it will work for list and blank views."

    Looks like only customized buttons can be hidden rather than the standard.


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Monday, August 24, 2015 6:18 PM
  • Hi Chris,

    Yep, your right. But this also applies for custom buttons in the action bar.

    So in short, it is not possible to set any property on buttons, custom or standard, in an actionbar in a datasheet view!

    I (and I'm not alone in this) have a strong wish this will be possible in the earliest next SP or release.

    Thanks for your input Chris!

    Paul.

    • Marked as answer by Paul Live Thursday, August 27, 2015 10:11 AM
    Thursday, August 27, 2015 10:11 AM

All replies

  • I'm not sure but I think the issue is that in Datasheet view there is more than one record displayed so even though a Record may be current, the datasheet view prevents this from working. Have you tried using it on a single Record Form to see if it works? or try using the Conditional Value?

    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Monday, August 17, 2015 9:14 PM
  • Thanks Chris,

    I've tried this on a other machine with all English language and it is still a problem. So..

    It seems to me that setting a button available or not on the event of selecting a record in a list is standard procedure in many cases. Should be a peace of cake then in any design tool or programming language ;-).

    I'm not sure what you mean with using the Conditional Value. Can you please explain?

    Here an image of the (very simple) macro that is used on the On Current event. It just sets the button available depending the content of a ID field in the current row.

    Image of macro

    I've tried with just the one setting the property on false/no/0. Same result.

    Thanks.


    • Edited by Paul Live Tuesday, August 18, 2015 9:11 AM
    Tuesday, August 18, 2015 8:58 AM
  • Hi,

    OK, tried this on a form (as Chris advised) and, yes, I can set the enabled property of a custom button.

    But... this is not what I want. I want to be able to present a button only when it can be of use! So in a list of records, when the user selects an item (record) in this list (Datasheet view) I present buttons that can be used with this record. Just as Access is doing her self with the Add, Update and Delete buttons in the action bar.

    Thanks for any idea

    Paul

    Tuesday, August 18, 2015 9:41 AM
  • But... this is not what I want. I want to be able to present a button only when it can be of use! So in a list of records, when the user selects an item (record) in this list (Datasheet view) I present buttons that can be used with this record. Just as Access is doing her self with the Add, Update and Delete buttons in the action bar.

    Hi Paul,

    You could set the enabled property of the custom button in the Current event of the form, or the Enter event of a control.

    Imb.

    Tuesday, August 18, 2015 1:09 PM
  • oKay I see,

    First if the txtViewActiviteitID is an Auto Number then the Field will only be Null on a new Record. So the only time you would not see the btnViewActiviteit is when the insertion point is set to the New Record. Also the Enabled versus Visible properties...When not Visible it really is not enabled to the end user anyway. but this is the way you would set up the Macro


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Tuesday, August 18, 2015 5:01 PM
  • Hi Guys,

    Thanks for thinking with me.

    To be clear, setting the property is working on a single record form but it is just not working on a datasheet view (on the On Current event of the datasheet view).

    Below an image of the form (Dutch). In the red circle the buttons I like to be disabled\enabled depending of the record selection in the datasheet view (see red arrows, selecting the second or third row should result in a disabled button). The ActiveitID to check is a foreign key field in the row/record, not a prime/autonumber. The datasheet (incl. the buttons) is a sub-view in the single record form (master/child relation).

    Thanks,

    Paul.

    Tuesday, August 18, 2015 7:26 PM
  • Hi Paul,

    Did you try rewriting the Macro as suggested above?

    What are the results?


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Tuesday, August 18, 2015 7:39 PM
  • Hi Chris,

    Although I believe that the logic is not the problem, I did test your suggestion. No result, still same error.

    I did test it in a datasheet view that is not a sub-view. Still, same error.

    I think there is a problem with setting a property (any property) of a button on the On Current of a datasheet view.

    Is it possible for you to run a little test on this on a SharePoint env., just to see if it is a bug? I'm running on prem SharePoint (SP1 15.0.4569.1506).

    Thanks.

    PS. I found that I'm not the only one http://www.developerteacher.com/msdn/access-web-app-giving-user-feedback-in-a-datasheet-form-166138

    • Edited by Paul Live Thursday, August 20, 2015 2:30 PM
    Thursday, August 20, 2015 1:07 PM
  • Good Morning Paul,

    After re-reading I am not sure the On Current Event is the right event for your need. The On Current Event sets the property when you bring the Record to the Form and make it Current. It sounds like you are wanting the buttons to change as a person is making changes to the record. If this is the case you probably need to invoke the After Update of each control that you want to make a difference on the buttons.

    Does this sound more like what you are looking for?


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Friday, August 21, 2015 1:10 PM
  • Hi Chris,

    Not really. It is much simpler.

    When the user selects a row in the datasheet view it depends on the contents of the row if a button in the actionbar is available or not. That's all. No editing of the record at all.

    The On Current fires on selecting a (different) row in the datasheet view. I've tested ;-) this because on selecting a row, any row, it displayed the error message. I can test the contents of the row, tested this also with message box debugging. The only thing that seems not possible is set a property value of a custom button in the datasheet actionbar.

    Paul.

    Monday, August 24, 2015 10:56 AM
  • Good Morning Paul,

    As I mentioned in an earlier post, I don't think it is possible. See the quote from the following thread...

    "Keep in mind that this technique won't work for datasheet views but it will work for list and blank views."

    Looks like only customized buttons can be hidden rather than the standard.


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Monday, August 24, 2015 6:18 PM
  • Hi Chris,

    Yep, your right. But this also applies for custom buttons in the action bar.

    So in short, it is not possible to set any property on buttons, custom or standard, in an actionbar in a datasheet view!

    I (and I'm not alone in this) have a strong wish this will be possible in the earliest next SP or release.

    Thanks for your input Chris!

    Paul.

    • Marked as answer by Paul Live Thursday, August 27, 2015 10:11 AM
    Thursday, August 27, 2015 10:11 AM
  • ...So in short, it is not possible to set any property on buttons, custom or standard, in an actionbar in a datasheet view!

    ...will be possible in the earliest next SP or release.

    As a suggestion, you can download and install the Office 2016 preview and use the Smiley / Frowny to tell the developer team this is a good thing to add. The 2016 preview usually will run on your PC for 120 days.

    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Thursday, August 27, 2015 1:28 PM