The Data has changed

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

The procedure below allows me to bypass "The Data has changed" error I get.
It seems silly, but it works, and all my data is correct every. My
procedure
is updating data in a "SubForm2".

Conclusion 1: The error is "just" an advisory message, and all we need do
is ignore it, as I do here.

Conclusion 2: The error makes SubForm2 Dirty without me telling it to do so.

While I've looked everywhere to find out what's causing this error, I've not
seen anything that really explains what's going on. Maybe someone will take
a
stab at answering some/all of the following:

1. Is "The Data has changed" message "just" an advisory message?
2. If it is just an advisory message, can it be turned off?
3. Since I know this error will occur "nearly" every time I call the
procedure,
is there a way to prevent it before hand?
4. What is the syntax for making SubForm2 Dirty?
5. If I make SubForm2 Dirty, will it prevent the error from occurring? If
so,
do I make it Dirty Within the procedure, or Before calling the
procedure?
6. If I make SubForm2 Dirty, and it prevents the error from occurring, then
why does MSAccess do this? I don't understand why this is necessary
as my silly procedure accomplishes the same thing.
7. Any comments for all us non-experts that will help clarify this
particular error
message will be appreciated.

My procedure follows:
Thanks,
Bernie

Private Sub TestError()
On Error GoTo ShowError
ResumeAfterError:
.....
.....
.....
.....
Exit Sub
ShowError:
If Err.Number = 7878 Then
' MsgBox "TestError " & Err.Number & " " & Err.Description
Resume ResumeAfterError
Else
MsgBox "TestError " & Err.Number & ", Description = " &
Err.Description
Exit Sub
End If
End Sub
 
Bernie,

The revised code should work. Note the "On Error goto 0" should be the
number "zero" and not the letter "O".

Private Sub TestError()
On Error GoTo ShowError
......
......
......
......
Exit Sub
ShowError:
On Error goto 0
End Sub

-Alias
 
Alias

Thanks for your reply and suggestion.
I have reviewed "Help" for "On Error" and find some very interesting
information.
I have changed my code to simply "Resume Next" at ShowError, which works
fine and is much less code than I had before, and is much cleaner.

My original code, your suggestion, and my new "Resume Next" all make the
procedure
work, but these do not help to answer my questions. I still don't know
what's happening
when Err.Number=7878.

Thanks again for your help.
Bernie
 
bw,

It may be the method your using to update your subform that's causing the
error.

I also have code that updates a subform as well and I don't get any errors
after the update. My code grabs all the selected items from a Listbox named
"lstAdmin" then updates my subform named "sfrmAdmin ".

Take a look at my update code and maybe you can rewrite yours to match then
try your update again:

-------------------------------------------------------------------------
'Open appropriate table for this record.
Set db = CurrentDb
Set rs = db.OpenRecordset("EmployeeCourseJoin", dbOpenDynaset)

'Update selected items of related fields.
For Each SelectedItem In lstAdmin.ItemsSelected
rs.AddNew
rs![Training Courses_ID] = Me.lstAdmin.Column(0, SelectedItem)
rs![Employees_ID] = Me.cboEmp_Name.Value
rs("Doc_Number") = Me.lstAdmin.Column(1, SelectedItem)
rs.Update
Next

rs.Close
Set db = Nothing
Set rs = Nothing

'Save current record
DoCmd.RunCommand acCmdSaveRecord

'Refresh the subform
Me.sfrmAdmin.Requer
 

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

Back
Top