By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,105 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,105 IT Pros & Developers. It's quick & easy.

Copying MDBs Via Code

P: n/a
I have a Jet based app in which the user will find it convenient to
create new back ends occasionally or frequently as s/he desires. This
is a single user app so having a consistent back end is not a requirement.

The back end has a large number of tables and a considerable number of
relationships to help ensure data integrity and actually relies on
cascade deletes for a lot of its transactions. I want the user to be
able to specify a new back end (I use the Ken Getz Open File API calls
to do this) and then have a new MDB created without any data.

My first thought on doing this was have a "template" mdb handy that can
be used as a skeleton. But since I'm not implementing security, it's
possible users could mess this up.

Other than writing a lot of extensive create table/index code and
whatever needs to be done to create relationships in Jet, is there a
more creative way to do this?

Thanks in advance.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Tue, 25 Jan 2005 00:33:44 -0330, Tim Marshall
<Sc**********@Im.Going.Home> wrote:

I have used the template route before, and it was very well received,
even though the target audience was not very sophisticated.
Users were even allowed to add some data to the template, so a new db
would not be completely empty.

-Tom.
I have a Jet based app in which the user will find it convenient to
create new back ends occasionally or frequently as s/he desires. This
is a single user app so having a consistent back end is not a requirement.

The back end has a large number of tables and a considerable number of
relationships to help ensure data integrity and actually relies on
cascade deletes for a lot of its transactions. I want the user to be
able to specify a new back end (I use the Ken Getz Open File API calls
to do this) and then have a new MDB created without any data.

My first thought on doing this was have a "template" mdb handy that can
be used as a skeleton. But since I'm not implementing security, it's
possible users could mess this up.

Other than writing a lot of extensive create table/index code and
whatever needs to be done to create relationships in Jet, is there a
more creative way to do this?

Thanks in advance.


Nov 13 '05 #2

P: n/a
Tom van Stiphout wrote:
I have used the template route before, and it was very well received,
even though the target audience was not very sophisticated.
Users were even allowed to add some data to the template, so a new db
would not be completely empty.


Tom, I will probably go with this method too. Now for a question I
should know - do you create the new mdb? I've gone back to A97 help and
am able to figure out (and have done so in old A97 apps I've done) how
to create a new, empty database via the createworkpace and
createdatabase methods, but I've never copied one databse to another.

Shell? Goodness, and I can't remember the DOS command for copying
files... <kneeling and reaching beseechingly to the heavens above> LORD
WHAT HAS WINDOWS DONE TO ME???!!!
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #3

P: n/a
Tim Marshall wrote:
Shell? Goodness, and I can't remember the DOS command for copying
files... <kneeling and reaching beseechingly to the heavens above> LORD
WHAT HAS WINDOWS DONE TO ME???!!!


Don't bother replying Tom, I remembered.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #4

P: n/a
On Tue, 25 Jan 2005 00:33:44 -0330, Tim Marshall
<Sc**********@Im.Going.Home> wrote:
I have a Jet based app in which the user will find it convenient to
create new back ends occasionally or frequently as s/he desires. This
is a single user app so having a consistent back end is not a requirement.

The back end has a large number of tables and a considerable number of
relationships to help ensure data integrity and actually relies on
cascade deletes for a lot of its transactions. I want the user to be
able to specify a new back end (I use the Ken Getz Open File API calls
to do this) and then have a new MDB created without any data.

My first thought on doing this was have a "template" mdb handy that can
be used as a skeleton. But since I'm not implementing security, it's
possible users could mess this up.

Other than writing a lot of extensive create table/index code and
whatever needs to be done to create relationships in Jet, is there a
more creative way to do this?

Thanks in advance.
--

Hi
There are some (undocumented?) functions in Access for dumping all
objects other than tables to text, and someone else has had a go at
tables (I assume you only want the table defs, not the data). Maybe
you can use this to set up the template.
David

Nov 13 '05 #5

P: n/a
On Tue, 25 Jan 2005 12:38:43 -0330, Tim Marshall
<TI****@antarctic.flowerpots> wrote:

Only 1 hour and 20 minutes later. A record? :-)

-Tom.

Tim Marshall wrote:
Shell? Goodness, and I can't remember the DOS command for copying
files... <kneeling and reaching beseechingly to the heavens above> LORD
WHAT HAS WINDOWS DONE TO ME???!!!


Don't bother replying Tom, I remembered.


Nov 13 '05 #6

P: n/a
Tom van Stiphout wrote:
On Tue, 25 Jan 2005 12:38:43 -0330, Tim Marshall
<TI****@antarctic.flowerpots> wrote:

Only 1 hour and 20 minutes later. A record? :-)


Tee hee hee 8) When I was doing A97 a few years ago, I would often post
and then realize or find the answer on my own, often in a much shorter
time than that! 8)

I think, like a lot of things in life, when you take the time to tray
and organize your thoughts logically to communicate to tothers, the
answer comes to you.

That sounds like it should be a song lyric of sorts...

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #7

P: n/a
Tim Marshall <TI****@antarctic.flowerpots> wrote:
I think, like a lot of things in life, when you take the time to tray
and organize your thoughts logically to communicate to tothers, the
answer comes to you.


Likewise. Sometimes I'll grab someone, non technical, and explain the problem.
Usually by the end I have the answer and the person goes "Ok, Tony, glad I could
help."

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #8

P: n/a
d.***************@blueyonder.co.uk (David Schofield) wrote:
There are some (undocumented?) functions in Access for dumping all
objects other than tables to text, and someone else has had a go at
tables (I assume you only want the table defs, not the data). Maybe
you can use this to set up the template.


The undocumented SaveAsText and LoadFromText may help if an object is corrupted or
otherwise behaving weirdly.
At the debug/immediate window type:
Application.SaveAsText acForm,"MyForm","c:\form.txt
You can load the file into a new MDB.
Application.LoadFromText acForm,"MyForm","c:\from.txt"

Sample code at http://www.datastrat.com/Code/DocDatabase.txt

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.