B
Bill
Marsh,
I have found the offending module. It has nothing to
do directly with the forms that were failing. It is one
of the general modules that runs at startup and loads
up a collection of global variables that are dim'd in
an "un-called general module" thereby preserving
them throughout the applications life.
What's new in V7.2 of the application is that there
are 3 new fields added to one of the tables beginning
with V7.2 and this module now checks for those
new fields in the backend mdb. If they are absent,
the code tbldefs an appendage of the three new
fields. That all seemed to work okay in-so-far as
the adding of the fields. However, it appears that
the "field checking" code has somehow left the
backend mdb in an un-desired state, as seen in
the failures we've been discussing. Doug Steele
had shown me how to do the tbldefs, but I must
have not learned my lesson completely.
If I can't find the problem myself, I would ask
your permission to e-mail you a text file of the
general module with the V7.2 changes highlighted
for your inspection. I realize you probably have
better things to do with your time, so please
accept my apologies for asking if that's not
acceptable to you.
Bill
I have found the offending module. It has nothing to
do directly with the forms that were failing. It is one
of the general modules that runs at startup and loads
up a collection of global variables that are dim'd in
an "un-called general module" thereby preserving
them throughout the applications life.
What's new in V7.2 of the application is that there
are 3 new fields added to one of the tables beginning
with V7.2 and this module now checks for those
new fields in the backend mdb. If they are absent,
the code tbldefs an appendage of the three new
fields. That all seemed to work okay in-so-far as
the adding of the fields. However, it appears that
the "field checking" code has somehow left the
backend mdb in an un-desired state, as seen in
the failures we've been discussing. Doug Steele
had shown me how to do the tbldefs, but I must
have not learned my lesson completely.
If I can't find the problem myself, I would ask
your permission to e-mail you a text file of the
general module with the V7.2 changes highlighted
for your inspection. I realize you probably have
better things to do with your time, so please
accept my apologies for asking if that's not
acceptable to you.
Bill
Marshall Barton said:It worked once, then doesn't work again??? Totally weird!
You don't have an incomplete transaction going on, a machine
that's in a cache thrashing state, or a horribly slow
server, do you?
Starting over is really tedious, but I don't have a better
idea.
Good luck,
--
Marsh
MVP [MS Access]
RATS! I thought we'd hit "pay-dirt" when I first tested
the newly created mdb with all the imports. However,
after I did some additional regression testing for many
of the other functions, I returned to the offending function
only to find that it was once again failing.
I don't know what else to do other than to re-build V7.2
starting from the V7.1 source adding the changes one at
a time and testing the offending form each time anything
is added.
I can see that you have replied to some other folks in this
thread, but I can't see what they said. I hope someone else
has a better idea than I do.
Since logic seems to have flown out the window, I think it's
time to take the usual copout and blame it on some kind of
corruption. The fact that you said somewhere that the
identical code in an older version of your app runs fine
also lends credence to corruption being the culprit.
There are a few things you can do to try to clear it, but no
guarantees. First make sure you have a backup in case
things get worse. I think(?) the first thing to try is to
decompile. Use the Start button's Run command:
"path\MSACCESS.EXE" "path\yourapp.mdb" /Decompile
Be sure to hold down the shift key to prevent any startup
procedure from running. Then use Tools - Compact (holding
the shift key down) and close Access. While holding the
shift key down, open Access with your database, then hit
Ctrl+g to get to the VB window and use Debug - Compile and
close Access. Finally, try the problem to see if all that
made a difference.
A different thing to try is to create a new, blank mdb, set
all the options the way you want, especially make sure Name
AutoCorrect is OFF. Then import everything from the problem
mdb.
Note that a common cause of front end corruption is editing
a form/report's module while the form/report is open in any
view except design view.
Bill wrote:
Three DoEvents didn't have any affect. However, if I
insert MsgBox "Hi" and wait 3 or 4 seconds before
I click Okay, then the Requery will return the just
inserted record. If I click Okay as fast as the message
MsgBox appears, I get an empty subform, i.e., I do
have to wait a few seconds before clicking Okay.
I'm out of ideas at the moment.
I put a breakpoint at the statement before the Execute
and slowwwwwwwly stepped through the Execute
and Requery. The inserted record then appeared in
the Requery. I'll try inserting a DoEvents or two.
I've never experienced the problem. You say that it works
if you do something innocuous, but doesn't that mean that
the Requery was removed or that you put a break point on
it? If so, I think that's an invalid test. Maybe adding a
DoEvents (or two) before the Requery might be effective??
Bill wrote:
That's what I believed when I wrote the code. However,
I have to perform a couple of incidental screen actions
before the data inserted displays in the subform. I added
the dbFailOnError to the Execute, but that didn't produce
any errors nor solve the problem.
One interesting observation is that it only fails when the
record inserted is THE FIRST record that would appear
in the Recordsource of the subform. Like the Recordsource
is "no records found" in the initial opening of the subform
and the record inserted is the FIRST.
What else might it be?
Bill wrote:
In the following segment of code, a record has been
inserted into the RecordSource of a subform. I'm
missing a very fundamental, I think, statement that
insures that the insert has completed before the
Requery is issued. What might that be?
tmpSQL = "INSERT INTO [DonRegFam](FundID,DOE,FamilyID,Amount,Type)"
tmpSQL = tmpSQL & " VALUES(" & cboFunds.Column(0) & ", " & DVal &
",
"
tmpSQL = tmpSQL & FamID & ", " & Me.AmtBox & ", " & TypeVal & ");"
CurrentDb.Execute tmpSQL
Me.DonationsSubform.Form.Requery
Me.CashBox = False
Me.AmtBox = 0
Me.AmtBox.SetFocus
Me.Record.Visible = False
Me.PrtStmtCmd.Visible = True
The Execute method runs synchronously, so you should not
have to worry about it. You might want to use dbFailOnError
just in case the query can not do what you told it to do.