Share via

Trigger Event on Record Change

Anonymous
2010-09-22T15:04:38+00:00

I have a form with various fields that all but one is normally disabled eg. you can see but can't modify.  The one field which is enabled is a checkbox.  I have two questions.

  1. I find the disabled fields difficult to read because they are disabled and i have tried changing various properties of backcolor, font color etc to help the visibility of the data as you scroll through records.  The reason for disabling is so the operator can not change/modify them.  Is there an alternate way to accommodate the security of the data or the color/visibility issue?
  2. What event procedure would you recommend to use that when it occurs will evaluate the checkbox and if it is true i would like to enable some of the fields that are disabled.  I've tried the update event for the form and as i scroll through records i can't seem to get the code to run that will evaluate the checkbox value. Essentially i want the event to trigger when a new data record is presented in the form by scrolling through the data table.

thanks

DaveM

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
    2010-09-23T22:50:59+00:00

    Set the form's Allow Additionss, AllowEdits and AllowDeletions properties to No to effectively make the form read only.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-09-23T18:44:52+00:00

    I have a follow up question.  As i scroll through the data records the form is functioning fine however when i reach the end of the data table the form is presented with a blank record.  This normally wouldn't be an issue however it the checkbox i mentioned earlier is selected when at this blank record it allows other fields to be enabled and data can be entered thereby creating a new record when/if the operator selects the recordsave cmd i have in place. 

    How do i keep the form from scrolling to the open/last 'blank' record?  Essentially i want to stop at the last record which has data in it and go no further.  All this form is doing is allowing the operator to scroll through the data so they can approve the document/workorder so that it may go on to the next approvals step.

    Thx

    DAve

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-09-22T19:24:59+00:00

    thanks to both of you.

    Dave

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-09-22T15:51:18+00:00

    "dmarkie" wrote in message news:*** Email address is removed for privacy ***

    I have a form with various fields that all but one is normally disabled eg. you can see but can't modify.  The one field which is enabled is a checkbox.  I have two questions.

    1. I find the disabled fields difficult to read because they are disabled and i have tried changing various properties of backcolor, font color etc to help the visibility of the data as you scroll through records.  The reason for disabling is so the operator can not change/modify them.  Is there an alternate way to accommodate the security of the data or the color/visibility issue?

    In the data tab of the properties sheet for that control, change the control to locked, but leave enabled = yes. That way, the control will not be dimmed out. You can also remove the tab stop, so during tabbing around on the form, the control will be skipped over.

    "dmarkie" wrote in message news:*** Email address is removed for privacy ***...

    I have a form with various fields that all but one is normally disabled eg. you can see but can't modify.  The one field which is enabled is a checkbox.  I have two questions.

    1. What event procedure would you recommend to use that when it occurs will evaluate the checkbox and if it is true i would like to enable some of the fields that are disabled.  I've tried the update event for the form and as i scroll through records i can't seem to get the code to run that will evaluate the checkbox value. Essentially i want the event to trigger when a new data record is presented in the form by scrolling through the data table.

    For just about any control, check box, combo box etc, when you want to do something AFTER a change been made, you use the aptly named "after update" event. This will take care of WHEN you change the control. So, for each control that has some setting, the code could be placed in the after update event to set/un-set or do whatever you require. However, when you navigate to a new record, then all this code out of the blue does not run (too slow, too much waste).

    So, you also as a rule have to place the SAME code in the forms on-current event. So, when you move to a new record, you need that code to run again. It is thus likely best to build a SINGLE routine that both the several after update event(s) can call, and also the on-current event. Your goal is to only code one routine. If you place all the code in each after update event for the 3-5 controls, that takes care of when you change the control, but you still need to run the same code when you move to a new record (after update events ONLY fire when you change the control, not when you navigate). So, build ONE routine that all after update + the on current event can call, and thus you only write the code once to handle this.

    Note that in place of running code in the on-current + after update events, you can often use conditional formatting to hide or enable a control. In fact, for a continues form you MUST do this. IN a Continues form there is ONE instance of each control that is is used over and over. So, with the exception of conditional formatting, in a continues form, since you ONLY placed the control ONCE on the screen there is ONLY ONE set of properties for that control. (so, all copies will take on whatever you set in code, so in this case, conditional formatting is really your only choice).

    --

    Albert D. Kallal (Access MVP)

    Edmonton, Alberta Canada

    *** Email address is removed for privacy ***

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2010-09-22T15:34:38+00:00

    1)  If you set both the Enabled = No and Locked to Yes, the control will look normal , but users will not be able to interact with it in any way.  The fore and back colors can then be set however you want to give some kind of indicator of the situation.

    2)  Use the form's Current event if the form is single view.  If the form is continuous or datasheet view, you may want to try using Conditioanl Formatting (Format menu).

    Was this answer helpful?

    0 comments No comments