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

Opening Another Database from WITHIN a Database

I have a database (2000.mdb) which links to my data tables (Data2000.mdb).
The database has a Main Menu screen (not a switchboard - a custom one). I
need to import records from 5 text files into the 5 different Tables in
Data2000.mdb.

Here was my plan:
Create various Import specs in Data2000.mdb
Create a Macro (in Data2000.mdb) which calls each of the specs
sequentially.

Place a button on the Main Menu (2000.mdb), which closes the current
database (optional), opens Data2000.mdb, runs the Macro (Import Reg), then
returns the user to the original Menu in the original database (2000.mdb)

I can't seem to get past running the Macro. See my code below:
Private Sub cmdOpenDataTables_MouseUp(Button As Integer, Shift As Integer, X
As Single, Y As Single)

Dim wrkJet as Workspace
Dim dbsAnother as Database

Set wrkJet = CreateWorkspace("DataWorkspace", "admin", _
"", dbUseJet)
Workspaces.Append wrkJet

Set dbsAnother = wrkJet.OpenDatabase("Data2000.mdb")

With dbsAnother
DoCmd.RunMacro "Import Reg"
End With

End Sub

I keep getting a "Can't find Macro Import Reg" error.
Any suggestions? Is there an easier way to automate this? Is part of the
problem is having 2000.mdb open (and linked) to Data2000.mdb when I try to
execute this?

Thanks in advance for any assistance.
--
Andi Plotsky
IRIS, LLC
2859 Galahad Drive
Atlanta, GA 30345

404-321-9459 (office)
404-636-2331 (fax)
Nov 13 '05 #1
4 1877
In 2000.mdb, link the tables in the Data2000.MDB, and import the data into
the linked tables from 2000.mdb. You are complicating a simple matter trying
to _run_ the update in the data database.

Larry Linson
Microsoft Access MVP

"Andi Plotsky" <ir******@bellsouth.net> wrote in message
news:wF*************@bignews5.bellsouth.net...
I have a database (2000.mdb) which links to my data tables (Data2000.mdb).
The database has a Main Menu screen (not a switchboard - a custom one). I
need to import records from 5 text files into the 5 different Tables in
Data2000.mdb.

Here was my plan:
Create various Import specs in Data2000.mdb
Create a Macro (in Data2000.mdb) which calls each of the specs
sequentially.

Place a button on the Main Menu (2000.mdb), which closes the current
database (optional), opens Data2000.mdb, runs the Macro (Import Reg), then
returns the user to the original Menu in the original database (2000.mdb)

I can't seem to get past running the Macro. See my code below:
Private Sub cmdOpenDataTables_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim wrkJet as Workspace
Dim dbsAnother as Database

Set wrkJet = CreateWorkspace("DataWorkspace", "admin", _
"", dbUseJet)
Workspaces.Append wrkJet

Set dbsAnother = wrkJet.OpenDatabase("Data2000.mdb")

With dbsAnother
DoCmd.RunMacro "Import Reg"
End With

End Sub

I keep getting a "Can't find Macro Import Reg" error.
Any suggestions? Is there an easier way to automate this? Is part of the
problem is having 2000.mdb open (and linked) to Data2000.mdb when I try to
execute this?

Thanks in advance for any assistance.
--
Andi Plotsky
IRIS, LLC
2859 Galahad Drive
Atlanta, GA 30345

404-321-9459 (office)
404-636-2331 (fax)

Nov 13 '05 #2
That's what I tried at first, but when it was time to specify which existing
table to import it to, the linked tables weren't listed. Is there a way
around this? (I was using TransferText in the Macro and a saved Spec.)

Andi



"Larry Linson" <bo*****@localhost.not> wrote in message
news:vP******************@nwrddc03.gnilink.net...
In 2000.mdb, link the tables in the Data2000.MDB, and import the data into
the linked tables from 2000.mdb. You are complicating a simple matter trying to _run_ the update in the data database.

Larry Linson
Microsoft Access MVP

"Andi Plotsky" <ir******@bellsouth.net> wrote in message
news:wF*************@bignews5.bellsouth.net...
I have a database (2000.mdb) which links to my data tables (Data2000.mdb). The database has a Main Menu screen (not a switchboard - a custom one). I need to import records from 5 text files into the 5 different Tables in
Data2000.mdb.

Here was my plan:
Create various Import specs in Data2000.mdb
Create a Macro (in Data2000.mdb) which calls each of the specs
sequentially.

Place a button on the Main Menu (2000.mdb), which closes the current
database (optional), opens Data2000.mdb, runs the Macro (Import Reg), then returns the user to the original Menu in the original database (2000.mdb)
I can't seem to get past running the Macro. See my code below:
Private Sub cmdOpenDataTables_MouseUp(Button As Integer, Shift As Integer,
X
As Single, Y As Single)

Dim wrkJet as Workspace
Dim dbsAnother as Database

Set wrkJet = CreateWorkspace("DataWorkspace", "admin", _
"", dbUseJet)
Workspaces.Append wrkJet

Set dbsAnother = wrkJet.OpenDatabase("Data2000.mdb")

With dbsAnother
DoCmd.RunMacro "Import Reg"
End With

End Sub

I keep getting a "Can't find Macro Import Reg" error.
Any suggestions? Is there an easier way to automate this? Is part of

the problem is having 2000.mdb open (and linked) to Data2000.mdb when I try to execute this?

Thanks in advance for any assistance.
--
Andi Plotsky
IRIS, LLC
2859 Galahad Drive
Atlanta, GA 30345

404-321-9459 (office)
404-636-2331 (fax)


Nov 13 '05 #3
Why use a saved spec? Link the tables, then use a saved query
(an append query) to transfer records from one table to another.

In a macro, use RunQuery to do the transfer.
In code use RunQuery or DB.Execute

(david)

"Andi Plotsky" <ir******@bellsouth.net> wrote in message
news:jX*****************@bignews2.bellsouth.net...
That's what I tried at first, but when it was time to specify which existing table to import it to, the linked tables weren't listed. Is there a way
around this? (I was using TransferText in the Macro and a saved Spec.)

Andi



"Larry Linson" <bo*****@localhost.not> wrote in message
news:vP******************@nwrddc03.gnilink.net...
In 2000.mdb, link the tables in the Data2000.MDB, and import the data into
the linked tables from 2000.mdb. You are complicating a simple matter trying
to _run_ the update in the data database.

Larry Linson
Microsoft Access MVP

"Andi Plotsky" <ir******@bellsouth.net> wrote in message
news:wF*************@bignews5.bellsouth.net...
I have a database (2000.mdb) which links to my data tables

(Data2000.mdb). The database has a Main Menu screen (not a switchboard - a custom one). I
need to import records from 5 text files into the 5 different Tables
in Data2000.mdb.

Here was my plan:
Create various Import specs in Data2000.mdb
Create a Macro (in Data2000.mdb) which calls each of the specs
sequentially.

Place a button on the Main Menu (2000.mdb), which closes the current database (optional), opens Data2000.mdb, runs the Macro (Import Reg),
then returns the user to the original Menu in the original database (2000.mdb)
I can't seem to get past running the Macro. See my code below:
Private Sub cmdOpenDataTables_MouseUp(Button As Integer, Shift As Integer,
X
As Single, Y As Single)

Dim wrkJet as Workspace
Dim dbsAnother as Database

Set wrkJet = CreateWorkspace("DataWorkspace", "admin", _
"", dbUseJet)
Workspaces.Append wrkJet

Set dbsAnother = wrkJet.OpenDatabase("Data2000.mdb")

With dbsAnother
DoCmd.RunMacro "Import Reg"
End With

End Sub

I keep getting a "Can't find Macro Import Reg" error.
Any suggestions? Is there an easier way to automate this? Is part of

the problem is having 2000.mdb open (and linked) to Data2000.mdb when I
try to execute this?

Thanks in advance for any assistance.
--
Andi Plotsky
IRIS, LLC
2859 Galahad Drive
Atlanta, GA 30345

404-321-9459 (office)
404-636-2331 (fax)



Nov 13 '05 #4
Actually, I ended up with the simplest solution possible - I gave my import
files a different name (e.g. Events1.txt, instead of Events.txt, which would
have overwritten the table) and did a TransferText macro (into Events
Table)and it worked fine. But I'll keep the AppendQuery option in mind when
I don't have the "power" to dictate the filename specs.

Thanks for your help, Larry and David -

Andi
"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:40***********************@news.syd.swiftdsl.c om.au...
Why use a saved spec? Link the tables, then use a saved query
(an append query) to transfer records from one table to another.

In a macro, use RunQuery to do the transfer.
In code use RunQuery or DB.Execute

(david)

"Andi Plotsky" <ir******@bellsouth.net> wrote in message
news:jX*****************@bignews2.bellsouth.net...
That's what I tried at first, but when it was time to specify which

existing
table to import it to, the linked tables weren't listed. Is there a way
around this? (I was using TransferText in the Macro and a saved Spec.)

Andi



"Larry Linson" <bo*****@localhost.not> wrote in message
news:vP******************@nwrddc03.gnilink.net...
In 2000.mdb, link the tables in the Data2000.MDB, and import the data into the linked tables from 2000.mdb. You are complicating a simple matter

trying
to _run_ the update in the data database.

Larry Linson
Microsoft Access MVP

"Andi Plotsky" <ir******@bellsouth.net> wrote in message
news:wF*************@bignews5.bellsouth.net...
> I have a database (2000.mdb) which links to my data tables

(Data2000.mdb).
> The database has a Main Menu screen (not a switchboard - a custom one).
I
> need to import records from 5 text files into the 5 different Tables in > Data2000.mdb.
>
> Here was my plan:
> Create various Import specs in Data2000.mdb
> Create a Macro (in Data2000.mdb) which calls each of the specs
> sequentially.
>
> Place a button on the Main Menu (2000.mdb), which closes the current > database (optional), opens Data2000.mdb, runs the Macro (Import

Reg), then
> returns the user to the original Menu in the original database

(2000.mdb)
>
> I can't seem to get past running the Macro. See my code below:
>
>
> Private Sub cmdOpenDataTables_MouseUp(Button As Integer, Shift As

Integer,
X
> As Single, Y As Single)
>
> Dim wrkJet as Workspace
> Dim dbsAnother as Database
>
> Set wrkJet = CreateWorkspace("DataWorkspace", "admin", _
> "", dbUseJet)
> Workspaces.Append wrkJet
>
> Set dbsAnother = wrkJet.OpenDatabase("Data2000.mdb")
>
> With dbsAnother
> DoCmd.RunMacro "Import Reg"
> End With
>
> End Sub
>
> I keep getting a "Can't find Macro Import Reg" error.
> Any suggestions? Is there an easier way to automate this? Is part
of the
> problem is having 2000.mdb open (and linked) to Data2000.mdb when I

try
to
> execute this?
>
> Thanks in advance for any assistance.
>
>
> --
> Andi Plotsky
> IRIS, LLC
> 2859 Galahad Drive
> Atlanta, GA 30345
>
> 404-321-9459 (office)
> 404-636-2331 (fax)
>
>



Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicola | last post by:
Hi Everyone, I am new to programming and would like to know how to open an access Report from within vb 6. I am trying to write a program to organise cross stitch threads. I have found out how...
3
by: VanIkyn | last post by:
Hello peoples, This is a last resort, as I've run out of search strings I can think of for this problem. There may very well be a simple and logical solution that I have overlooked. Thanks in...
3
by: Mike Wilson | last post by:
Is there a way to open an OLE DB database from within Access? I would like to use the Access GUI with its table and query explorer to examine a database only available through an OLEDB provider...
0
by: Marco Castro | last post by:
Im trying to create a system service that will read some records within an access file. From these values I will then be able to see if other software in the system is up to date and install the...
12
by: insomniux | last post by:
Hi, In my database (access 2000) everything is done within the main form ("OpenForm"). It has a timer which triggers the code below. It first closes all reports and forms. Then it reopens the main...
4
by: Q | last post by:
Hello you all, I have to write a .NET application (VB.NET) where the user can open spreadsheets, word documents, pdf documents, textfiles.... from within the same window. I was thinking of...
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
0
by: janders468 | last post by:
Hi, I have been messing around with automating Access (I am attempting to actually manipulate the Access objects themselves so it requires going beyond data access) from a c# program (long story...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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.