Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS Access

Posted on 2011-03-07
14
Medium Priority
?
217 Views
Last Modified: 2012-05-11
How do I link to data base using VBA Code.
0
Comment
Question by:PasqualeMarcantonio
14 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 1000 total points
ID: 35059939
Here is the De-Facto standard:

Relink Access tables from code
http://www.mvps.org/access/tables/tbl0009.htm

You will need this also (referenced in the KB):

Call the standard Windows File Open/Save dialog box
http://www.mvps.org/access/api/api0001.htm

mx
0
 

Author Comment

by:PasqualeMarcantonio
ID: 35060013
I plan to open a form, test for data in a table, if the table is not found then link to the data base using VBA Code.
0
 
LVL 40

Assisted Solution

by:als315
als315 earned 1000 total points
ID: 35060023
Example from Access help:
DoCmd.TransferDatabase acLink, "ODBC Database", _
    "ODBC;DSN=DataSource1;UID=User2;PWD=www;LANGUAGE=us_english;" _
    & "DATABASE=pubs", acTable, "Authors", "dboAuthors"

DoCmd.TransferDatabase acLink, "Microsoft Access", _
    "C:\My Documents\NWSales.mdb", acTable, "MyTable"
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

by:mstlwilliams
ID: 35060024
If you want to link to a Microsoft Access database from a standalone VB program, you can use ADODB.  The connection string will need to be specific for Access.  I'm looking for a sample and will post it when I find it.
You can also set up an ODBC connection for the MS Access database and use that in your VB for connecting.

0
 
LVL 75
ID: 35060085
There is no need to us ADODB to link to an Access MDB or ACCDB.

mx
0
 
LVL 85
ID: 35060296
<There is no need to us ADODB to link to an Access MDB or ACCDB.>

If you mean to link tables then you're right - DAO is much easier to work with if the goal is to build linked tables from within Access.

If the OP wishes to connect to an Access database from another environment (like VB or ASP) there's nothing wrong with using ADO. In many cases it's preferable to build a connection to the Database using ADO and then work with that connection, depending on what you want to accomplish.
0
 
LVL 75
ID: 35871357
Has this question been resolved?  Can we close the question ?

thx.mx
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36175847
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 85
ID: 36175848
The author asked how to link tables with VBA. Both of these are correct, valid solutions:

http:#a35059939
http:#a35060023

Suggest you split the points between them
0
 
LVL 75
ID: 36176996
I concur with LSM ...

mx
0
 

Expert Comment

by:South Mod
ID: 36230702
All,
 
Following an 'Objection' by LSMConsulting (at http://www.experts-exchange.com/Q_27193677.html) to the intended closure of this question, it has been reviewed by at least one Moderator and is being closed as recommended by the Expert.
 
At this point I am going to re-start the auto-close procedure.
 
Thank you,
 
SouthMod
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

885 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