Creating Databases

T

TADpole

For every record in (Parent) Database,
I want to create a child database.

For example, Cards in a tickler file have Name, address, cell number, etc.

Then the card has date and action
1. Date and action can have several entries
2. Card gets refiled for follow up date
 
J

Jeff Boyce

Terminology, to start:

Access has records in tables, so I assume you have one table with persons
(?your Parent table), and you are looking to create a table to hold all
related date/action information (?your Child table).

Your Child table will need to know its Parent -- you do this by including a
field in the Child table that holds the record ID of its Parent. The record
ID of the Parent is called a Primary Key. The field in the Child table that
holds that Parent Primary Key value is called a Foreign Key field.

Does that help?
 
T

TADpole

Let me try to rephrase

For every primary key, I want to create a database.

For example, if Jeff Boyce is a record in the (Parent) and your key is
12345678890,
I want to create a db named 1234567890 (or Jeff Boyce).


I appreciate your help
TADpole
 
J

Jeff Boyce

You will have difficulty understanding what Access tells you, and what the
newsgroups tell you, if you continue to use "database" instead of "table".

If you have a record in your Person table ("table", not database), and a
primary key for that record (see your example), any/all Child records
(records in a Child "table", not database) will need to have a field to hold
a copy of that key value (and it will be considered a foreign key in this
Child table).

NOTE: You do NOT want to create a separate Child table for every row/record
in your Parent table. This would mean you would have to add a new table
every time you added a new person. Instead, your Child table will have a
structure something like:

ChildTable
ChildRecordID (the Primary Key of this Child table record)
ParentRecordID (a foreign key, pointing back to the Parent of this Child
record)
EventDate (NOTE: don't use "Date" as a field name -- it is an Access
reserved word)
Action

Or am I still confused?
 
J

John Vinson

TADpole said:
For every record in (Parent) Database,
I want to create a child database.

For example, Cards in a tickler file have Name, address, cell number, etc.

Then the card has date and action
1. Date and action can have several entries
2. Card gets refiled for follow up date

I just want to reinforce Jeff's good advice here. An Access Database (.mdb
file) is a *container* for multiple forms, reports, tables, modules, and
other features. What you are describing would NOT require the creation of a
second database, or even a second table. A "card" in a tickler file logically
corresponds to a record in a single table, not to a new table or a new
database. If you have a one (contact) to many (actions) relationship, you
just need two Tables joined in a one to many relationship.
 
J

jacksonmacd

TADpole

What you are asking to do is very unconventional. You haven't
described *why* you are trying to create new databases, so it would
appear that you are making a mistake, thus the answers from Jeff and
John.

However, if you really *do* want to create multiple databases for some
unknown-to-us reason, then you will need to use the CreateDatabase
method of the DAO Workspace object in some VBA code. Here is a line
that uses that method:

Set db = wrkDefault.CreateDatabase(strTempDatabase, dbLangGeneral)

where the various objects and variables are created and populated
elsewhere in the program. If this looks like Greek to you, then the
short answer is "... you can't create databases..."


Let me try to rephrase

For every primary key, I want to create a database.

For example, if Jeff Boyce is a record in the (Parent) and your key is
12345678890,
I want to create a db named 1234567890 (or Jeff Boyce).


I appreciate your help
TADpole

**********************
(e-mail address removed)
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top