473,397 Members | 2,116 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,397 software developers and data experts.

Need to open a database from another database

I need to be able to open a database from a macro on a form while already in one. Can anyone help?
Apr 19 '07 #1
6 1452
ADezii
8,834 Expert 8TB
I need to be able to open a database from a macro on a form while already in one. Can anyone help?
The following Public Function will:
  1. Open an External Access Database named Employees.mdb in the C:\Test Directory (C:\Test\Employees.mdb)
  2. Print all the Last Names in the tblEmployees Table to the Immediate Window
  3. If you so desire, a Macro within your Database can call this Function directly
Expand|Select|Wrap|Line Numbers
  1. Public Function fOpenExternalDatabase()
  2. Dim wrkMySpace As Workspace
  3. Dim dbExternal As DAO.Database
  4. Dim rstExternal As DAO.Recordset
  5.  
  6. 'Create Microsoft Jet Workspace object
  7. Set wrkMySpace = CreateWorkspace("", "admin", "", dbUseJet)
  8.  
  9. 'Open Database object from external Microsoft Jet database
  10. 'for exclusive use.
  11. Set dbExternal = wrkMySpace.OpenDatabase("C:\Test\Employees.mdb", True)
  12.  
  13. Set rstExternal = dbExternal.OpenRecordset("tblEmployees", dbOpenDynaset)
  14.  
  15. rstExternal.MoveFirst
  16.  
  17. Do While Not rstExternal.EOF
  18.   Debug.Print rstExternal![LastName]
  19.   rstExternal.MoveNext
  20. Loop
  21.  
  22. rstExternal.Close
  23. dbExternal.Close
  24. wrkMySpace.Close
  25. End Function
Apr 19 '07 #2
NeoPa
32,556 Expert Mod 16PB
This'll confuse ADezii no end, but didn't we get robbed by the refs in UEFA this year?
Scanadalous!

Glad you got sorted here BTW. ADezii's our top man on macros and such.
Apr 25 '07 #3
ADezii
8,834 Expert 8TB
This'll confuse ADezii no end, but didn't we get robbed by the refs in UEFA this year?
Scanadalous!

Glad you got sorted here BTW. ADezii's our top man on macros and such.
This'll confuse ADezii no end, but didn't we get robbed by the refs in UEFA this year?
Scanadalous!
You are 100% right because I am totally confused. What exactly does the above-mentioned quote mean, Neo?
Apr 25 '07 #4
NeoPa
32,556 Expert Mod 16PB
You are 100% right because I am totally confused. What exactly does the above-mentioned quote mean, Neo?
Spurs is the short name for a North London football team - Tottenham Hotspur. I'm guessing, with a name like SpursGirl, that the OP is also a fan.
We were (just) knocked out of the UEFA-Cup last week due to a number of consistently awful decisions by the refs in both legs (home and away). It would be no exaggeration to say that they were responsible for changing the score by about 5 goals to our detriment (As most of the decisions were penalties or free-kicks, it's impossible to be absolute). It's certainly true to say that we would have thrashed Sevilla with any sort of fair referee though. Even if only one of the legs was reffed fairly we would have got through without a problem.
Apr 25 '07 #5
ADezii
8,834 Expert 8TB
Spurs is the short name for a North London football team - Tottenham Hotspur. I'm guessing, with a name like SpursGirl, that the OP is also a fan.
We were (just) knocked out of the UEFA-Cup last week due to a number of consistently awful decisions by the refs in both legs (home and away). It would be no exaggeration to say that they were responsible for changing the score by about 5 goals to our detriment (As most of the decisions were penalties or free-kicks, it's impossible to be absolute). It's certainly true to say that we would have thrashed Sevilla with any sort of fair referee though. Even if only one of the legs was reffed fairly we would have got through without a problem.
Now I'm only partially confused!
Apr 25 '07 #6
NeoPa
32,556 Expert Mod 16PB
Now I'm only partially confused!
Tell me which bit(s) are still confusing and I'll happily explain.
Apr 25 '07 #7

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

Similar topics

3
by: I Are Confused | last post by:
I am trying to open Database #2 while in Database #1 and delete a table that is in #2 so that I can copy a table from #1 into #2 - all through a function. My Database #2, as part of the start up,...
0
by: Tom Wild | last post by:
Hi I am trying to connect to an Access database from a WebPage in VB.Net but when I try to open the connection I get the following error: The Microsoft Jet database engine cannot open the file...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
4
by: Mr Seth T | last post by:
I am supposed to implement a web app in C#/.NET and it needs to be installed on the customer's server and ran from anywhere. The problem is this software needs to be licensed by user (i.e. they...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
5
by: Eric Layman | last post by:
Hi, Many years ago when I first learnt abt web dev in school, I was taught this methodology: <html> blah blabh
4
by: Wayne | last post by:
How do I get rid of the generic Windows "Open File - Security Warning" that appears when I try to open a database that resides on another PC on my home network? This is not the annoying macro...
12
by: Steve | last post by:
I have a database that raises an error when you try to open it and it doesn't open. Trying to open the database with the OpenDatabase method raises the same error. Trying to import any objects...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
6
by: zaina | last post by:
hi everybody i am nwebie in this forum but i think it is useful for me and the member are helpful my project is about connecting client with the server to start exchanging messages between...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.