none
Access Web App Macro to disable field RRS feed

  • Question

  • Hello... I am struggling to find a way to disable field based on other field status... For example, If my Status is "Completed", I want to be able to disable field "Hours" so people cannot go back and change the value.

    I was trying ON LOAD and ON CURRENT with following macro and it didn't work:

    If[StatusComboBox]="Competed" Then
    
    SetProperty
    
    Control Name HoursTextBox
    
    Property Enabled
    
    Value False
    What this does, it disables Hours Field across all records as long as you have at least one Status that is "Completed" which is not not what I want. I was also looking at data macro "For Each Record In" but Data Macro doesn't have an option to "Set Property". Can anybody help shed some light on this matter?



    Friday, September 2, 2016 3:48 PM

Answers

  • Hi CROforce,

    On Load event will fire when you open the Form list, and On Current will fire when you navigate between records. To work around your issue, I think you could add Else statement to enable to TextBox in On Current event.

    Here is a simple macro.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, September 5, 2016 2:24 AM

All replies

  • Reading between the lines I think you have a datasheet or continuous form with multiple records. It is by design that setting Enabled would apply for the whole column. That's because there really is only one control and it is being repeated.

    Is there a Locked property you can use in the Current event?


    -Tom. Microsoft Access MVP

    Friday, September 2, 2016 4:58 PM
  • There is no "Locked" property in Web App... Not to my knowledge at least. This should be part of the basic functionality in my opinion... What for example if I have Pass Fail field and I want to have a Color of the field in RED if I have it set to Fail. The same thing would apply as described in my issue above. It would change color to RED to all records as long as I have only one record marked as fail. There is got to be way to do this or???
    Friday, September 2, 2016 5:17 PM
  • Hi CROforce,

    On Load event will fire when you open the Form list, and On Current will fire when you navigate between records. To work around your issue, I think you could add Else statement to enable to TextBox in On Current event.

    Here is a simple macro.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, September 5, 2016 2:24 AM