473,326 Members | 1,972 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,326 software developers and data experts.

Opening a form in a different database.

From a command button on a form, how can I open a second form which resides in a different database?
Dec 23 '10 #1
1 1256
ADezii
8,834 Expert 8TB
The following Code will Open the Orders Form in the Northwind 'External' Database residing in the C:\Test\ Folder, from the Current Database:
Expand|Select|Wrap|Line Numbers
  1. 'Declare in Declarations Section of a Module
  2. Dim appAccess As Access.Application
  3.  
Expand|Select|Wrap|Line Numbers
  1. 'Initialize PATH to External Database
  2. Const conPATH_TO_EXTERNAL_DB As String = "C:\Test\"
  3. Dim strDB As String
  4.  
  5. strDB = conPATH_TO_EXTERNAL_DB & "Northwind.mdb"
  6.  
  7. 'Create New Instance of Microsoft Access.
  8.  Set appAccess = CreateObject("Access.Application")
  9.  
  10. 'Open database in Microsoft Access window.
  11. appAccess.OpenCurrentDatabase strDB
  12.  
  13. 'Open the Orders Form.
  14. appAccess.DoCmd.OpenForm "Orders"
P.S. - Any questions, feel free to ask.
Dec 23 '10 #2

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

Similar topics

20
by: xixi | last post by:
hi, we use db2 udb v8.1 on windows, i am trying to use federated database objects to create wrapper, even though i have update dbm cfg using federated yes, i still get error "the instance for the...
3
by: WindAndWaves | last post by:
Hi there, Can anyone tell me how I can run code/macro in a different database??? Below are the two situations where this may be applicable. 1. run a macro/code in another database that sends a...
2
by: Henriksen, Jonas F | last post by:
Hi, is it possible to write a trigger, using pl/pgSQL, that updates tables in a different database than the one the trigger is called from? If it is, what is the syntax for calling the other...
2
by: Coquette | last post by:
Hi all. I'm new here. I wanted to ask your opinion about *joining two tables* from *two different database* together. Is *that* possible? My project requires me to join identical tables from...
1
by: Devlei | last post by:
I use the FileOpen dialog to allow users to select a different database (same structure) to open and use. Currently I change the connection string then open the selected database, but it seems so...
2
by: scott.alfon | last post by:
Hello, i need your help. I want to implement a php-script where I can access to different database types as PostSQL, MySQL etc. Is that possible? Furthermore I want to include an access...
0
by: veer | last post by:
Hi i have a probleum in opening the access database which is on my LAN Networking with DAO. It is connecting and dispalaying the database name but when i use to open it, error displayed named"...
2
by: ezly80 | last post by:
hai... i have problems to connect the jboss server with two different database which is Oracle and Mysql. this two db have same db name example Student. if one of the db corrupt the server can...
1
by: okonita | last post by:
Hi all, I have a need to copy data from one database/schema to a different database schema. Yes, I can use export/import but that is not "elegant". Yes, I can try a redirected Restore from Backup...
24
by: tokcy | last post by:
Hi everyone, I want to connect two different database server using php/mysql. Suppose i have some dat on www.xyz.com and i want to select that data on www.abc.com How do i integrate two...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.