Which Form procedure

Zaeed

Registered Annoyance
Local time
Tomorrow, 07:29
Joined
Dec 12, 2007
Messages
383
Is there a overall form procedure that is triggered if an unbound object is altered?
 
NO, I don't believe. Would the closest be Onchange, I wonder?
 
hmmm, i'm trying to make my form aware of any changes to the controls, and i'd rather not go and manually configure each control.

Feel free to throw any ideas at me. :)
 
DIRTY refers to the bound controls only, but that obviously doesn't work. i supposed you could split it up, and write a DIRTY event for your form, and then a CHANGE event for every unbound control. or are there too many unbounds?
 
There is about 25 controls.

I'm currenty experimenting with creating a Macro that does what i want, and then set each control to that macro.
Unsure if this is wise, but its a lot less coding.
 
Hmmm, it seems to have an issue in finding the form :s

this is my code:
Code:
Public Function modify()
    Forms!frm_Change!frm_Change_Modified = True
End Function

Thats right isn't it? frm_Change_Modified is a checkbox. modify() is located in a Module
 
Wait.. got it...

the expression had to be
Code:
    Form_frm_Change!frm_Change_Modified = True
 
Manipulating OnChange() for each control is too much ...

So you plan on building a macro, and then going to each control and point it to the macro?

Sounds like an extra step on top of something that is already too much .....

-dK
 
dk,

If a user loads this form it requires a tick of approval. This is required so that the task defined by the form can progress. In the event of the user making a change to the form and then clicking approve the form needs to beable to respond to this change and reset the approval process so that the alteration can be checked. Since there is no event triggered by altering an unbound form I had to come up with a way of generating one.

One method would be to manually write code for each control; or simply create one bit of code, and then point each control to it, which is as simple as selecting it from a drop down menu.
My form is made up of unbound forms.
 
I see ... to paraphrase back ...

1. An unbound form (with unbound controls) is critical to some process.

2. An approval gets the user access to this form.

3. If the user changes any unbound text box (or some number of them) then they can move another step in the overall process.

That's my understanding .... my take on it is since there is no data storage apparatus, why not a global variable?

Call it like GBL_Status. Prior to entering it gets some code value like 001 (completed process step 1), it enters the form it gets 002 (completed process step 3), as it exits it gets 003. That way you can run a Select Case against the variable to clue you in to the state of process the user is in.

Now, to check for changes of each control ... well ...
I was originally thinking of cycling through the form controls and calling a generic OnUpdate event. Then you are still back to programming each control to call the cycle effect. How about the form OnClick event?

If they click a button to exit said form, you can choose to cycle each control and check for a null value. If false then some counter = counter +1 and they can exit the form when counter = 25. It doesn't tell you if the data in the controls are valid, just that something is in them.

Just a alot of .02,
-dK
 
Let me explain agian.

Someone opens my database. The click new Change. This opens a blank form, they fill out all the required information, and hit save.

Based on the information on the form, certain people are notified of the submission, and they are required to view the submission and then approve or reject it.

In the event of one of the approvers viewing the change and hitting approve, all is well and good, the system checks off that person and waits for the rest of the approvals.

However,
if one of the approvers decides to make a change to the submission, then this change must be captured, and the approval process reset.

This is why i'm doing what i'm doing. I just needed a way to capture any change to a control so that it could be correctly handled.


I have it working, so thanks for your help.
 
If you want to have some kind of generic event, you would have to use a class module that stores a collection of controls with events, then use that class module to manage the controls' events.

A example air-code for a class module:

Code:
Private WithEvents uctl As ctl 'An variable referencing an unbound control.
Private colctl As Collection 'A collection of all controls declared to the class

Private sub Init(frm As Form) 'Class has built in event Initalize but we need to pass a form so we create our own constructor.

Dim ctl as Control

For each ctl in frm.Controls
    If ctl.ControlSource = "" Then
        Set uctl = ctl
        colCtl.Add uctl
    End If
Next

End Sub

Private Sub Class_Terminate() 'Use built in event for terminating class so we can clean up

For each uctl in colCtl
    colCtl.Remove uctl
    Set uctl = Nothing
Next

End Sub

Private uctl_AfterUpdate() 'The event for any control stored in collection
'NOTE: Maybe AfterInsert is actually appropriate. Experiment.

'We have to identity the control and assign a validation code
Select Case uctl.Name
     Case foo
         'Do validation code based on data entered in foo
     Case bar
         'Do validation code based on data enetered in bar
     Case Else
         '???
End Select

End Sub

For some details how to do this, take a look at Peter's Software which has a great demo for "Validate Class"

Linky

HTH.
 

Users who are viewing this thread

Back
Top Bottom