Screen Thinks It Has Unsaved Changes

P

PeteCresswell

I've been here before and somebody pointed me in the right
direction.... but I've Googled and Googled but cannot find it again.

The basic situation:
-----------------------------------------------------------------------------------------------------------------
- Form bound to work table

- We blow away the work table

- We re-populate the work table

- We attempt to requery the form ("Me.Requery") or we try to
lock a control

- The .Requery traps out bc the form thinks it has
unsaved changes on it ("2166: You can't lock a control while it has
unsaved changes."
or "2118: You must save the current field before you run the Requery
action." and/or
maybe a couple others.
 
D

Dirk Goldgar

PeteCresswell said:
I've been here before and somebody pointed me in the right
direction.... but I've Googled and Googled but cannot find it again.

The basic situation:
-----------------------------------------------------------------------------------------------------------------
- Form bound to work table

- We blow away the work table

- We re-populate the work table

- We attempt to requery the form ("Me.Requery") or we try to
lock a control

- The .Requery traps out bc the form thinks it has
unsaved changes on it ("2166: You can't lock a control while it has
unsaved changes."
or "2118: You must save the current field before you run the Requery
action." and/or
maybe a couple others.


In what event are you performing these actions?

Would you care to post your code?
 
P

PeteCresswell

In what event are you performing these actions?

Would you care to post your code?

I was holding back on that bc it's such a rat's nest and I figured
inflicting it on innocent readers might have the wrong effect. Also
there are quite a few interrelated routines...

Instead, how about I post a micro-application that incorporates same?

I've got it down to where it only coughs up it's guts and dies after
doing a "New" and clicking "Save" - which adds a record, but requires
the user to dismiss the error dialog and re-position the list to load
the newly-added record.

A reaonable person might think I'm using a sledgehammer to kill a fly
- but I live and die by my little "To-Do"/"Done" lists. I use this
form in all my applications as a sort of developer tool. And every
six months or so I drink too much coffee or something and manage to
fat-finger the edit session and lose some or all of my notes.....

Anyhow, here's an example micro-application: ftp://www.wchs59.com,
then
download Pete'sTrailOfTears.zip

About 260k, zipped.
 
P

PeteCresswell

In what event are you performing these actions?

Would you care to post your code?

This is my second post for this. At my end it looks like Google ate
the first one.

ftp://www.wchs59.com

Then download Pete'sTrailOfTears.zip

I've got it to where it only dies after a "New" and then a "Save".

A resonable person might say I'm using a sledghammer to kill a
fly..... but I live and die by these little "To-Do"/"Done" lists in my
various projects and I got tired of every six months or so fat-
fingering an edit sesh and losing all or part of my notes in a bound
form.
 
D

Dirk Goldgar

PeteCresswell said:
And if that doesn't work, I can email the file to you.

It's less than 300k.


Pete, the FTP site isn't accepting anonymous logins, so just e-mail it to
me. You can get my e-mail address by removing NO SPAM and .invalid from the
reply-address of this message, or you can get it from my website, which is
listed in my sig.
 
D

Dirk Goldgar

PeteCresswell said:
I've been here before and somebody pointed me in the right
direction.... but I've Googled and Googled but cannot find it again.

The basic situation:
-----------------------------------------------------------------------------------------------------------------
- Form bound to work table

- We blow away the work table

- We re-populate the work table

- We attempt to requery the form ("Me.Requery") or we try to
lock a control

- The .Requery traps out bc the form thinks it has
unsaved changes on it ("2166: You can't lock a control while it has
unsaved changes."
or "2118: You must save the current field before you run the Requery
action." and/or
maybe a couple others.


Having looked at your database, I've determined that it's not really that
the form thinks it's Dirty when it isn't. Instead, it's that the form
thinks one of its controls, a list box, has an uncommitted value. This
seems to be because you are setting the value of the list box by using its
..Selected property, using code like this:

With Me.lstChanges
.SetFocus
.Selected(0) = True
End With

This does serve to set the value of the list box to the first listed item,
but the .Selected property isn't handled entirely consistently, and it seems
Access also thinks you have an uncommitted value in there. So when you
requery the list box, it complains. It seems to me that this is a bug in
Access.

When I change the code to this instead:

With Me.lstChanges
.Value = .ItemData(0)
End With

Access stops complaining and the error is not raised.
 

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

Top