Change location of MS Access Database

Posted on 2003-03-12
Medium Priority
Last Modified: 2010-05-01
I have a project that I want someone to choose if they want to look at the network database or their local database on the drive, how do i change the location of the database so that someone can choose which database they look at each time they access the program.  I did not define the database via program commands i defined them through the properties of the ole data object.  I am a rookie to VB so be gentile.
Question by:skip0464
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Expert Comment

ID: 8121177
You must have the path and file name of the database as part of your connection string or you couldn't get a connection to ANY database, right?

You can let them choose any database they want if you give them a way to supply the path and name.  They might use a textbox (easiest for YOU - hard for them) or by using the common file dialog (harder for you - REALLY REALLY easy for them).

But, if you only want to offer a choice between two known databases and aren't interested in ANY OTHER databases, why not just offer a dialog with a pair of radio buttons and let them click on the one they want.

Then your code can just open the one related to their choice, right?

Author Comment

ID: 8121252
I tried to do the radio button, but when i try to update the databasename property it does not seem to work, i am sure i am missing something simple, but after someone selects the radio button i tried to change the databasename property.  if my choices are M:\mailing or c:\project\mailing.mdb what would the syntax be to update the correct property.  

Expert Comment

ID: 8121357
Please post your code.  I'll be happy to make changes to it.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8122647
I create an OLE object and adjust the properties: CONNECT is ACCESS 2000, DATABASENAME is M:\MAILING.MDB and RECORDSOURCE is MARKETING.  when i want to change the point to point locally i execute the statement:

dtamarketing.databasename = "C:\project\mailing.mdb"

dtamarketing is the ole object

so there is almost no code to access the database.

Accepted Solution

JH0401 earned 150 total points
ID: 8122711
dtamarketing.databasename = "C:\project\mailing.mdb"

Author Comment

ID: 8128261
Thanks, in the startup module i ask the question "do you want to connect to the network" and set the properties and do a refresh and it works.

Author Comment

ID: 8128272
this is the best site for vb info.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question