Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Major "poratability" problem.

Status
Not open for further replies.

elziko

Programmer
Nov 7, 2000
486
GB
I have just finished one of the applications I have written.

I have wondered around several offices in the building and installed it on every PC that needs it.

One function of the application uses the following code:

Tables.Clear
Dim db As Database
Dim qdef As QueryDef
Dim td As TableDef
Dim dbname As String
Set db = OpenDatabase(DatabaseDir.Path + "\" + DatabaseFile.Text)
For Each td In db.TableDefs
If td.Attributes = 0 Then Tables.AddItem td.Name
Next td
db.Close

... in order to display a list of tables in a database. This works fine on some PCs and on others it does NOTHING. No errors. It just does nothing.

What sort of thing could cause this? I dont know where to start on this one.

Any advice?

Many thanks,

elziko
 
First step is to find out which line is failing. To do this, add a On Error Goto statement. Then add line numbers to each line of code (skip comment lines and variable declaration lines). In your error handler, pop up a message box like this:

[tt]call MessageBox("Error " & Err.Number & " at line " & Erl, "Error")[/tt]

The Erl operator isn't documented anywhere, but it's been part of BASIC for decades.

If an error is triggered, it will tell you which line caused it. Right now, I am suspicious of the OpenDatabase line, since it references a path which may or may not exist on some PCs.

Chip H.
 
The path of the database DOES exist.

The code in question is contained within a function with an error handler. The strange thing is that no error occurs. It just does nothing.

I have since found that it only works on computers with "MapInfo" installed (a GIS system).

So I'm assuming that installing map info changes some sort of windows setting or installs some kind of database driver or something.

What seetings would need to be set or what files need to be installed for the code in my first post in this thread to work?

Thanks for your reply

elziko
 
Since there are no runtime errors I am assuming that the path exists, the database file exists, MDAC was properly installed, and the database was opened . . . so please forgive me for asking an obvious question, but on the machines that do not have "MapInfo" installed (where this code does nothing) are there any tables in the database with Attributes=0?
Any other issues in here should've caused a RunTime error (unless you are using an On Error Resume Next which I would not recommend). Check the database that you are opening . . . maybe the code is doing EXACTLY what you've told it to do. - Jeff Marler
(please note, that the page is under construction)
 
jmarler,

thanks for your reply.

The strange thing is I've tried the SAME database on all machines. I can see the tables in some but not others.

No, my error handler accounts for every concievable error and is actually longer than the main code in the function itself.

Although I dont get an error message could you tell me what MDAC is, how to check if its installed and how to install it if its not already there?

Many thanks

elziko
 
Right I've sorted it out now. I used a tried and trusted method.

Basically I went to the MDAC site at MS and downlaoded everything they had and tried each one!

It turned out that getting MS Jet SP3 solved my problem.

Should this sort of thing not throw up a runtime error though?

Thanks for your guidance

elziko
 
Hmm . . . MS Jet SP3 fixed your problem? Well, if I had to guess, I would say that either you had some corrupt Jet Engine DLLs on the system or the wrong version and SP3 either updated or repaired all of the required files. - Jeff Marler
(please note, that the page is under construction)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top