Unsaved Record Indicator

lmcc007

Registered User.
Local time
Today, 09:19
Joined
Nov 10, 2007
Messages
635
I do not want the record selector displayed. Is there a way to fake an Unsaved Record Indicator using an image? I tried:

Private Sub Form_Current()

Dim ctl As Control

If Me.Controls!ctl.Change Then
Me.Image124.Visible = True​
Else
Me.Image124.Visible = False​
End If​

End Sub
Of course, it didn't work.

Has anyone done this or have any ideas?
 
You might try:

If me.dirty = true then
me.image.visible = true
else
Me.image.visible = false
endif
 
Also, I would imagine you need to have this called by more than one events. Better to write a single Sub procedure and have those event call this procedure:

Current
Dirty
AfterUpdate

You may also need to check the case of Undo as well.
 
Thanks Mr. B,

I tried it a couple of ways--that is:

Private Sub Form_Dirty(Cancel As Integer)
Me.RecordSelectors = True​
End Sub​

and

Private Sub Form_Dirty(Cancel As Integer)
Me.Image18.Visible = True​
End Sub​


Now I am rethinking to see if I really need it and whether there are
any advantages or disadvantages to having it.

Do you know if it's professional to do this?
 
Also, I would imagine you need to have this called by more than one events. Better to write a single Sub procedure and have those event call this procedure:

Current
Dirty
AfterUpdate

You may also need to check the case of Undo as well.

I am not quite following you here. Are you saying to put it on On Current, Dirty, and After Update events? That is repeat three times.
 
Well, yes you need all three events, but you don't have to actually repeat the code. Example:

Code:
Private Sub Form_Current()
   UpdateDirtyState
End Sub

Private Sub Form_AfterUpdate()
   UpdateDirtyState
End Sub

Private Sub Form_Dirty(Cancel As Integer)
   UpdateDirtyState
End Sub

Private Sub UpdateDirtyState()
   Me.Image27.Visible = Me.Dirty
End Sub


You also need to check what happens with Undo event so the state is also updated. The reason I didn't list it so because I can't remember whether Undo event would fire too early to be of any value and/or other event will also fire that would change the dirty state.

HTH.
 
Well, yes you need all three events, but you don't have to actually repeat the code. Example:

Code:
Private Sub Form_Current()
   UpdateDirtyState
End Sub

Private Sub Form_AfterUpdate()
   UpdateDirtyState
End Sub

Private Sub Form_Dirty(Cancel As Integer)
   UpdateDirtyState
End Sub

Private Sub UpdateDirtyState()
   Me.Image27.Visible = Me.Dirty
End Sub


You also need to check what happens with Undo event so the state is also updated. The reason I didn't list it so because I can't remember whether Undo event would fire too early to be of any value and/or other event will also fire that would change the dirty state.

HTH.

If you hit Undo the record selector stays the same until you move to another field.
 
If you hit Undo the record selector stays the same until you move to another field.

Hm, yes. But the thread title said "Unsaved Record Indicator", which I took to mean you wanted to differentiate between a saved record and dirty (e.g. unsaved record), rather than just showing which record is currently selected. If you weren't after that, then my apologies for not understanding that point.
 
Hm, yes. But the thread title said "Unsaved Record Indicator", which I took to mean you wanted to differentiate between a saved record and dirty (e.g. unsaved record), rather than just showing which record is currently selected. If you weren't after that, then my apologies for not understanding that point.

I was just responding to your question re undo; I hadn't thought about it.
 

Users who are viewing this thread

Back
Top Bottom