VB application is not runnig

cjmoim used Ask the Experts™

I made an VB application, and it works perfectly fine
with my computer, but it is not running with other computers..I can install my application to other computers, and it loads the main screen, but whenever
I type the id and password, it shows the error message.
It seems like it can not get the information from
my MAINDB.mdb file..

I referenced Microsoft DAO 3.6 Object Library, and
used DAO method for getting data from Access database.

What might be the problem??
Please Help me out guys!!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Is MAINDB.mdb included with the installation?


Yes MAINDB.mdb is included

DAO 3.6 must have been installed on the target machine.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Is the DB marked read-only (frequently happens with a copy from CD) on the client machine?

Check the connection string to make sure you do not have an absolute path to your hard drive.

If the DB is in the same folder as the .exe, set the path to App.Path & "\MAINDB.mdb" or possibly "MAINDB.mdb" without a path.

It definitely shouldn't have "C:\...\MAINDB.mdb" unless you plan to create that path on the user's machine.
download and install the MDAC on the target machine
also, try switching over to ADO which is more advanced than DAO





I can not swich from DAO to ADO with this program since there will be a lot of changes on it.I am using DAO 3.6 ...And the following is the code for open database..

CurPath = App.Path
 If Right(CurPath, 1) <> "\" Then CurPath = CurPath + "\"
 Dim LoginDB As Database
 Dim LoginTB As Recordset
 Set LoginDB = OpenDatabase(CurPath & "MAINDB.MDB")

When I run the program from other machines, then click login button,  The error message is appears, it says Runtime error'3343' Unrecognized database format.  

The strange part is that if I run that .exe file from Support folder, then it runs perfect.  The Support folder
is the one that automatically made from package and diployment wizard..

>if I run that .exe file from Support folder, then it runs perfect

then you definitely have some sort of path problem.

I'd suggest trying this:

msgbox CurPath & "MAINDB.MDB"
Set LoginDB = OpenDatabase(CurPath & "MAINDB.MDB")

This may give you some clues since sometimes the path that you expect is not what you get.  Furthermore, I'd recommend using a variable to hold the path rather than the CurPath unless you specifically want to change the user's system to point to this path.
I suspect this IS NOT an issue with the path.  If the database cannot be found, you get a different error ("Could not find file...")

I suspect this to be a path problem.  The required DLLS are not in the path.  If you run it from the Support folder.  It has the DLLS it needs in the same directory.  Make sure all the DLLs are put in the Windows(WINNT) System32 directory and registered all should be well.  This should have happened with the mdac installation as so many others have said
Éric MoreauSenior .Net Consultant
Top Expert 2016

Are you using Data Controls? In this case, have a look at http://support.microsoft.com/default.aspx?scid=kb;en-us;238401

Sounds to me as if necessary DLL's were not registered.

Try to copy the DLL's from the Support-Directory into Windows\System (Win98) or \WinNT\System32 (WinNT) directory. Then run the Command-Prompt, change directory to System (or System32, look above) and start "regsvr32.exe NameOfDll.dll" for each required DLL.

(I made a small .bat to do this for me (+Switch /s for silent mode).

That way I can make sure all necessary Dll's are registered and I don't need to distribute a Setup-Utility.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial