473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to connect to other access datbase

When we want to connect to database we simply write
Expand|Select|Wrap|Line Numbers
  1. set db= current db
  2.  
What if i want to connect to other access database
Dec 4 '13 #1
3 1269
zmbd
5,501 Expert Mod 4TB
Expand|Select|Wrap|Line Numbers
  1. Dim zdb as DAO.Database
  2. set zdb = Opendatabase( [full path and name of file] )
  3.  
Will work for Access databases.
There are various other methods for connecting to MySQL, SQLServer, ORACLE, etc...
Dec 4 '13 #2
ADezii
8,834 Expert 8TB
You can also use the OpenCurrentDatabase() Method to open an external Access Database via Automation, but within the context of the Current Database.
  1. The following Code Sample will Open an Access Database within the Current DB, Open a Form from that DB, then Close it at some point.
    Expand|Select|Wrap|Line Numbers
    1. 'Include the following in Declarations section of Module.
    2. Dim appAccess As Access.Application
    3.  
    Expand|Select|Wrap|Line Numbers
    1. 'Initialize string to database path.
    2. Const conPATH_TO_DB = "C:\Business\2013\Invoices.mdb"
    3.  
    4. 'Create new instance of Microsoft Access.
    5. Set appAccess = CreateObject("Access.Application")
    6.  
    7. 'Open Database in Microsoft Access window.
    8. appAccess.OpenCurrentDatabase conPATH_TO_DB
    9.  
    10. 'Open Orders form.
    11. appAccess.DoCmd.OpenForm "frmInvoices"
    12.  
    Expand|Select|Wrap|Line Numbers
    1. 'Close the Database at some point
    2. appAccess.CloseCurrentDatabase
    3.  
Dec 4 '13 #3
zmbd
5,501 Expert Mod 4TB
rahul2310
FYI:

----------
application.opencurrentdatabase method (access)
office 2010
don't confuse the opencurrentdatabase method with the activex data objects (ado) open method or the data access object (dao) opendatabase method. The opencurrentdatabase method opens a database in the microsoft access window. The dao opendatabase method returns a database object variable, which represents a particular database but don't actually open that database in the microsoft access window.
----------
Dec 4 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: chris | last post by:
Hi, I try to connect to Access with php with te code below. The database and table are ok. <?php include('../adodb/adodb.inc.php'); $db =& ADONewConnection('access'); $dsn =...
2
by: CM Manager via DotNetMonster.com | last post by:
I am very frustrated due to this exception error I am receiving. I've tried searching numerous user support groups, Microsoft Support Net, Google, etc. and haven't found exactly my situation....
0
by: Parvez | last post by:
HI How to connect MS ACCESS in Netwaork base VB6.0 Programme from server I AM DEVLOPING A EMPLOYE ATTANEDENS RECORD PROJECT IN THIS I AM USING VB6.0 AND MS ACCESS AND WINDOEW XP IN MY PROJECT...
2
by: h.bournonville | last post by:
Hi, I try to connect a Access 2K db from a access 97 db. I try with a odbc driver and it does'nt work .does anybody can help me ? Thanks HB
1
by: czi02 | last post by:
how would I connect my access in my vb?
7
by: mahipalerasani | last post by:
I am trying to connect to the Access database for querying, inserting and updating the data using 'C' API's. If somebody has code to connect to Access Database using C API's can you you please...
2
by: Shubha Avinash | last post by:
How can i connect Ms access database through ADO.NET
4
by: chowdhury | last post by:
Hi, I am new in visual basic. i want to know how to connect and access data to MS Access or MS SQL database from a visual basic form.plz write me the code. Regards, chowdhury
3
by: bany | last post by:
Hello! Please can some one help in this: It is possible to connect an access db with electronic board? I have an accounting db and i need to connect it to poker machine board. Excample: when i...
1
by: prathaphs | last post by:
Hi I am using Perl 5.8.8 and i use DBI->connect("dbi:ODBC:driver=Microsoft Access Driver (*.mdb );dbq=$file" to connect to access. This used to work with access 2000. but now in access 2007 the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.