Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / January 2004

Tip: Looking for answers? Try searching our database.

unknown number of entries at design time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Cloud - 22 Jan 2004 17:57 GMT
Hi

    I've got a set of simple data types (numbers, a text
field) that I want to store in my database.  The problem
is that I don't know at design time how many of these
there will be.  I can specify the set of types (for
example: int, int, text), but I don't know how many times
this set will need to be stored.  Calling the above
(int,int,text) a set, I don't know how many sets there
will be. (Sorry about the repetition for those who got it
the first time...)
    Is there any way to do this in MS Access?

    Thanks in advance for any help you might be able to
offer...

            Mike
John Vinson - 22 Jan 2004 21:34 GMT
>Hi
>
[quoted text clipped - 8 lines]
>the first time...)
>     Is there any way to do this in MS Access?

ummm...

this is exactly how Access is designed to work.

You create a Table with the desired fields, of type int, int, and text
say; you can then add anywhere from zero to millions of records to
that table.

What you're calling a "set" would commonly be called a Record; what
you're calling a "data type" would commonly be called a Field.

Perhaps I'm misunderstanding the problem!

                 John W. Vinson[MVP]    
   Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
MIchael Cloud - 23 Jan 2004 17:07 GMT
Hi -- Thanks for the input.  In thinking about what you
said, at first I thought you were right, but on thinking
through building a solution along the lines of what you
had said I again came upon the same problem.  Let me tie
it down to specifics so that it is more clear.  Here is
the problem:

    I have a table a table called 'Sales'.  Every entry
in the table represents one credit card sale -- One
charge on someones CC, one transaction with the credit
card company.  In the data associated with a sale I want
to record (at least) the ID of each product that was sold
in that CC transaction.  I know the data type of an ID
(an int), but I don't know, at design time, how many
product ID's I will need to record.  Now what I was
thinking based on your comment, was, okay, I just create
a new table, whose record type is a Product ID (int), and
then have as many entries in that new table as I need.  
The problem with this solution is that we have pushed off
one problem by creating a new one.  The new problem is
that I now don't know how many tables I have in my
database at design time.  For each Sale, I have to
create, on the fly, a new table.  I am very new to
Access, but that sounds hard.  
    One obvious solution to this problem is that instead
of defining the Product ID entry as an int, I could
define it as an OLE object, specifically an excel spread
sheet, with a collection of product ID's.  I don't like
this solution because it seems that then I lose any built
in type checking, validation etc.  I have no control over
what my users will attach as a spread sheet.  I think.

    Comments, thoughts?

      Thanks for all your help

               Mike

>-----Original Message-----
>
[quoted text clipped - 28 lines]
>http://go.compuserve.com/msdevapps?loc=us&access=public
>.
John Vinson - 23 Jan 2004 21:18 GMT
>    I have a table a table called 'Sales'.  Every entry
>in the table represents one credit card sale -- One
[quoted text clipped - 4 lines]
>(an int), but I don't know, at design time, how many
>product ID's I will need to record.  

You're using a relational database; USE IT RELATIONALLY!

Take a look at the Northwind sample database that comes with Access.
It models *exactly* this scenario.

You have a many to many relationship between Sales and Products. The
way Access (or any relational database) handles many to many
relationships is with a third "resolver" table:

Sales
 SaleID Autonumber
 <credit card info>
 <sale date>
 <other sale-specific fields>

Products
 ProductID
 ProductName
 <other info about the product>

SaleDetails
 SaleID <link to Sales>
 ProductID <link to Products>
 Quantity
 <etc etc>

If a given Sale sold a dozen products, you'ld have a dozen rows for
that sale in SaleDetails. There is *no* need for a proliferation of
fields *or* of tables; you just add *records* in the resolver table.

                 John W. Vinson[MVP]    
   Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.