Dirty Event

  • Thread starter NeonSky via AccessMonster.com
  • Start date
N

NeonSky via AccessMonster.com

Hello Everyone, I am scratching my head over this one and am hoping you may
be able to assist. I have a form where when I page from one form to the next
I would like a text boxes value to appropriately updated. What is odd is that
when I go from one record to the next the record does not update, it keeps
the previously updated value from the previous record. The only time the text
boxes value appropriately updates is when a text character is entered into
other fields....hoping you may be able to help. Thank you! Below you will
find my code. Thanks again.

Private Sub Form_Dirty(Cancel As Integer)

Dim strComment As String

strComment = DLookup("[Comments]", "tblErrorComments", "ErrorID = forms!
frmDisputes!ErrorID") & " "
Me.Comments.Value = strComment

End Sub
 
D

Dirk Goldgar

NeonSky via AccessMonster.com said:
Hello Everyone, I am scratching my head over this one and am hoping you
may
be able to assist. I have a form where when I page from one form to the
next
I would like a text boxes value to appropriately updated. What is odd is
that
when I go from one record to the next the record does not update, it keeps
the previously updated value from the previous record. The only time the
text
boxes value appropriately updates is when a text character is entered into
other fields....hoping you may be able to help. Thank you! Below you will
find my code. Thanks again.

Private Sub Form_Dirty(Cancel As Integer)

Dim strComment As String

strComment = DLookup("[Comments]", "tblErrorComments", "ErrorID = forms!
frmDisputes!ErrorID") & " "
Me.Comments.Value = strComment

End Sub


The Dirty event isn't really appropriate for this, from your description.
The Dirty event only fires when a record is modified, so merely paging from
record to record won't fire it. I think you should probably be using the
Current event.
 
N

NeonSky via AccessMonster.com

Hello Dirk, Thank you for you response! Though when I change "Dirty" to
"Current", I receive the following error message "Procedure declaration does
not match description of event or procedure having the same name." Any
thoughts? Thanks!
Dirk said:
Hello Everyone, I am scratching my head over this one and am hoping you
may
[quoted text clipped - 18 lines]

The Dirty event isn't really appropriate for this, from your description.
The Dirty event only fires when a record is modified, so merely paging from
record to record won't fire it. I think you should probably be using the
Current event.
 
D

Dirk Goldgar

NeonSky via AccessMonster.com said:
Hello Dirk, Thank you for you response! Though when I change "Dirty" to
"Current", I receive the following error message "Procedure declaration
does
not match description of event or procedure having the same name." Any
thoughts?

The event procedure for the Dirty event has a Cancel argument, while the
event procedure for the Current event does not (because the Current event
can't be cancelled). Change the proc header that I presume you have now:

Private Sub Form_Current(Cancel As Integer)

to this:


Private Sub Form_Current()

That ought to fix it.
 
Top