Refresh Enabled/disabled status

Becca

Registered User.
Local time
Today, 08:03
Joined
Dec 12, 2001
Messages
58
Hi

I have a form which has a field called status. There are 3 status buttons in an option group which allows the user, depending on their access to:

1. Authorise,
2. Finalise, or
3. Reset to unauthorise.

Once the user clicks on Authorise, it will disable all controls from entry. Clicking on Reset resets the authorisation process and enables entry again.

My problem is that I cannot seem to get the forms to refresh their enabled/disabled once the option group selection has been changed. I have to exit the record and reenter.

This is a pain, and my users don't like it. I also don't like it because its fussy.

Does anyone have any ideas on how to get the form controls to refresh enabled/disabled without leaving the record. I have tried me.form.refresh and a lot of other combos.

Thanks
 
Post the code that is behind the option group.
 
At the moment my option group does not hold my code for the updating of the main form.

The option group has three buttons - which when pressed updates control [status] with either 1 (Reset), 2(Authorise) or 3
(Finalise). I also have a checkbox on the main form only available to the Administrator to lock the record and not allow a reset.

At the moment I have the folowing code in the OnCurrent and AfterUpdate events of my form "MainEntryForm". I tried putting it in the AfterUpdate part of my option group, but then I had lots of errors about not supporting that sort of thing happening in that particular place. The code for disabling/enabling all of the controls on the mainform works, but not immediately, I have to go out of the record and in again before it will work. A sample of my code in the afterUpdate event of my main form is below.


If Me.LOCKED.Value = True Then
Me.AllowEdits = False
Me.level.Enabled = False

Else
If Me.Status = 1 Or 0 Then
Me.AllowEdits = True
Me.Level.Enabled = True
Me.Category.Enabled = True
etc etc

Else
Me.AllowEdits = True
Me.level.Enabled = False
Me.Category.Enabled = False
etc etc
End if
End if

DoCmd.RunCommand acCmdRefresh
Me.Form.Refresh

Thanks for your help
 
The timing of the events as you have listed, is as expected.

The afterupdate event of a FORM does not "fire" until the record itself is updated (ie: moves from "dirty" to saved/updated record) This can occur by closing form, saving current record, moving to new record etc.

Note: if the record is not dirty, the AfterUpdate event of the form will not fire at all.

If you are certain that your code works, then I suggest you place it in the afterupdate event of the option group. The option group does not need to be bound in order to "fire" the afterupdate event of the option group.

Let me know if you are still having problems.

Brad.
 

Users who are viewing this thread

Back
Top Bottom