hi, may i know how to compile visual basic 6.0 file with access 2007. I can link but when i save it in an external device and try to run th exe. in other computer, it could be run, but the connection is lost, i tried to change the location of the access within the codes, but i failed. Can i know the solution? Thanks.

It seems that you have hard coded the path to the database. ALWAYS install the database in your application folder. Then in your code, use "App.Path" and the database name.

Post your code. we will help you :)

i tried to change the location of the access within the codes, but i failed.

As mentioned previously, don't hardcode locations of filenames.

Your application should normally store its data in the Application Data folder. Microsoft has given a name to this location for each user: %APPDATA%

So, an accepted practice is to save your data files in this folder using the following format: %APPDATA%\Company Name\MyData.xml

Saving your data in this manner insures that the data will be stored in the same location on different computers--even if the application data folder does not follow the same naming convention with a different operating system: e.g. Windows XP as compared to Windows 8.

Try using module for your database connection.

i.e.

Dim dbcon

dbcon = App.Path & "\Database\Main.accdb"

then make sure that you always include your database file with the Folder of your file/s.

If it is inside another folder, then:

    Dim dbcon

    dbcon = App.Path & "\Foldername\Database\Main.accdb"

And for the latest connection strings, please check THIS

Enjoy!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.