Dirty Event

B

box2003

I am using a form that is unbound and know I cannot use the Dirty event.
What can I use in its place?
 
B

box2003

I guess I could use the AfterUpdate event however, there are a lot of
controls on the forms. I think what I could do is to open the form in a
state where a user cannot change control values but, must click an edit
button that will change the form to allow edits. User makes changes, update
button becomes visible, then is forced to save updates. Update made, button
hides, form clears.

I am just thinking out loud.
 
M

Marshall Barton

box2003 said:
I guess I could use the AfterUpdate event however, there are a lot of
controls on the forms. I think what I could do is to open the form in a
state where a user cannot change control values but, must click an edit
button that will change the form to allow edits. User makes changes, update
button becomes visible, then is forced to save updates. Update made, button
hides, form clears.

I am just thinking out loud.


For an unbound form, you can use each control's AfterUpdate
event. For those controls that have no other need for an
AfterUpdate event, you can create a Function that uses
Me.ActiveControl to refer to the control that triggered the
event. Set these controls' AfterUpdate ***property*** to
=functionname()
so you don't have to have a separate procedure for every
control.

It has been years since I have had a real need for an
unbound form to manipulate data and the more I use Access,
the more I think bound forms are the only good way to deal
with data. Using AllowEdits, etc. is a perfectly valid and
easy approach to locking all the controls on a form.
However, most of the time, there are a few controls that you
want to be edited (e.g. find a record). In this kind of
situation, I like lock individual controls that should not
be edited. This is very easy to do by setting those
controls' Tag property to a specific string such as LOCK.
Then you can use a simple procedure to lock/unlock them:

Sub SetLocks(OnOff As Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Lock" Then ctl.Lock = OnOff
Next ctl
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top