Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Change location of MS Access Database

Posted on 2003-03-12
7
Medium Priority
?
122 Views
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.
0
Comment
Question by:skip0464
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:QJohnson
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?
0
 

Author Comment

by:skip0464
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.  
0
 
LVL 3

Expert Comment

by:QJohnson
ID: 8121357
Please post your code.  I'll be happy to make changes to it.
0
Technology Partners: 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

by:skip0464
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.
0
 
LVL 1

Accepted Solution

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

Author Comment

by:skip0464
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.
0
 

Author Comment

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

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

580 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