I'm having a nightmarish problem with a VB app I'm developing.
Here are the background details:
Access 97 database.
Program uses _one single_ mdb file.
Single user program - will _not_ be run in multi-user environment.
Everything is local, no networks involved.
Uses Jet version 3.51.
Database stuff via DAO/Microsoft Jet Engine workspace.
Error checking routines _all_ over the program.
Childishly simply queries - mostly "select * from blah where blah =
blah" that sort of thing.
Small number of records in the database.
Here is the problem:
On all but 2 machines I've installed it on (about 6 in total) the
program crashes (illegal operation dialog box with only a Close button
on win95, Dr Watson on NT) when attempting to execute particular
queries. Those queries are in the form of:
Set DY = MyDB.OpenRecordset(what)
MyDB.Execute what, dbFailOnError
These lines are contained in two separate functions, which are called
from anywhere in the program that wants to do a query - there are no
other "OpenRecordset" or "Execute" statements in the entire program.
This are definitely the lines upon which the program crashes, because I
have statements immediately before and after those lines that write to a
log file - when there's a crash, the immediately after statement never
On one machine I installed VB5 and ran the program in the development
environment, to see if I could get any more information. It simply
crashed when reaching one of the query code lines. I verified that this
was the crash point again by using breakpoints.
So, if that's what's causing the crash, there must be something wrong
with the queries I am executing, right? Well so I thought at first, but
as I mentioned before, the queries are childishly simple. Here's some
example of one query that causes a crash:
UPDATE Vehicles SET Odometer = 80000 WHERE VehicleID = 10
This query can be run from within Access itself, but from my program via
the Execute statement, it causes a crash.
So perhaps I haven't included all the necessary dll's on the target
machine? Well I installed VB5 itself, access 97, and the jet35upd.exe
from microsoft. No difference.
On my program I have an "about" box that displays the "DBEngine.Version"
property - and on all machines it confirms it to be 3.51.
The most puzzling thing about this problem is that on my development
machine (win95) and one other machine that I've installed it on (win98)
it works flawlessly. No crashes, no instability, it works _every time_.
While on the other machines, not a single error message, just _splat_.
I've had some small clues....on some queries I was running with a "WHERE
Table1.ThingID = Table2.ThingID" part to it, I noticed that in one table
the "ThingID" was indexed (it was the primary key - an autonumber) and
in the other table it was not indexed (it was simply a long integer).
Then when I changed it to an indexed field, that query didn't cause a
crash anymore. Why is that? I have no idea. Surely I can set a criteria
of comparing two fields as long as they are both the same data type
(long integer) even if one of them is indexed and the other isn't? Even
if you weren't supposed to do that, why does it work on some machines
and not others? Why don't I get any error messages?
This problem is driving me insane.....I can't imagine a simpler
environment for a database program to run in, i.e. one database file,
single user only, everything is local, etc. The queries I'm running are
such ordinary queries....
WHAT IS HAPPENING???
Gratitide of truly profound proportions to anyone that can shed some
light on this.