dbTalk Databases Forums  

A2K working out relationships between two tables

comp.databases.ms-access comp.databases.ms-access


Discuss A2K working out relationships between two tables in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
buckskin
 
Posts: n/a

Default A2K working out relationships between two tables - 03-15-2011 , 06:20 PM






I am confused by how I can save some user choices which are captured in one
tblData but I need to save them in tblDefinitions where there will be
multiple, different choices.

tblData stores the main data bound to a form.
The form is filtered to show a different dataset at a time. The user can
mark each desired line by selecting a checkbox.
Once they make those selections these can be saved to tblDefinitions. Then
they can change those definitions and save them again, creating a new set of
rows in tblDefinitions.

e.g if there are 10 selections from tblData.chkbox then there are 10 entries
in tblDefinitions. Tables as follows;

*tblData*
idData (Primary Key)
SomeData1
SomeData2
chkSelection (set to True when user ticks checkbox)

*tblDefinitions*
idDefs (Primary Key)
selectionId (Foreign key referencing Primary key of tblData - this only
appears if tblData.chkSelection is True)


This looks line one-to-one to me but the need to just to link to the idData
PK fields which are marked as true is throwing me. Is this simple or do I
need to be a bit more careful about the design here?


One more thing.
I will need some way of allowing the user to name the definitions in another
table called tblReports which will link to tblDefinitions - this will be
one-to-many (tblReports on the one side) - that sound ok?

thanks
Martin

Reply With Quote
  #2  
Old   
Phil
 
Posts: n/a

Default Re: A2K working out relationships between two tables - 03-16-2011 , 04:13 AM






On 16/03/2011 00:20:18, "buckskin" wrote:
Quote:
I am confused by how I can save some user choices which are captured in
one tblData but I need to save them in tblDefinitions where there will be
multiple, different choices.

tblData stores the main data bound to a form.
The form is filtered to show a different dataset at a time. The user can
mark each desired line by selecting a checkbox.
Once they make those selections these can be saved to tblDefinitions. Then
they can change those definitions and save them again, creating a new set
of rows in tblDefinitions.

e.g if there are 10 selections from tblData.chkbox then there are 10
entries in tblDefinitions. Tables as follows;

*tblData*
idData (Primary Key)
SomeData1
SomeData2
chkSelection (set to True when user ticks checkbox)

*tblDefinitions*
idDefs (Primary Key)
selectionId (Foreign key referencing Primary key of tblData - this only
appears if tblData.chkSelection is True)


This looks line one-to-one to me but the need to just to link to the
idData PK fields which are marked as true is throwing me. Is this simple
or do I need to be a bit more careful about the design here?


One more thing.
I will need some way of allowing the user to name the definitions in
another table called tblReports which will link to tblDefinitions - this
will be one-to-many (tblReports on the one side) - that sound ok?

thanks
Martin



Maybe I'm missing the point.
It appears that you have a standard invoice header, invoice line situation
here. The checkbox appears totally redundant because either there are or are
not definitions that apply to an item in your Data table. As these
definitions can be changed, I suggest that you use a form and subform to
input the information. So *tblData*
idData (Primary Key)
SomeData1
SomeData2

*tblDefinitions*
idDefs (Primary Key)
idData (ForeignKey)
Def ' Definition
DefTypeID (ForeignKey)

*tblDefTypes*
DefTypeID (PrimaryKey)
DefType

The subform would have a combobox to select the type of definition and
possibly this could indicate the report to be printed.

If you give a bit more detail of what you are trying to achive, with an
example, you may get better advice.

Phil

Reply With Quote
  #3  
Old   
buckskin
 
Posts: n/a

Default Re: A2K working out relationships between two tables - 03-16-2011 , 05:24 AM



"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote

Quote:
On 16/03/2011 00:20:18, "buckskin" wrote:
I am confused by how I can save some user choices which are captured in
one tblData but I need to save them in tblDefinitions where there will
be
multiple, different choices.

tblData stores the main data bound to a form.
The form is filtered to show a different dataset at a time. The user can
mark each desired line by selecting a checkbox.
Once they make those selections these can be saved to tblDefinitions.
Then
they can change those definitions and save them again, creating a new
set
of rows in tblDefinitions.

e.g if there are 10 selections from tblData.chkbox then there are 10
entries in tblDefinitions. Tables as follows;

*tblData*
idData (Primary Key)
SomeData1
SomeData2
chkSelection (set to True when user ticks checkbox)

*tblDefinitions*
idDefs (Primary Key)
selectionId (Foreign key referencing Primary key of tblData - this only
appears if tblData.chkSelection is True)


This looks line one-to-one to me but the need to just to link to the
idData PK fields which are marked as true is throwing me. Is this simple
or do I need to be a bit more careful about the design here?


One more thing.
I will need some way of allowing the user to name the definitions in
another table called tblReports which will link to tblDefinitions - this
will be one-to-many (tblReports on the one side) - that sound ok?

thanks
Martin




Maybe I'm missing the point.
It appears that you have a standard invoice header, invoice line situation
here. The checkbox appears totally redundant because either there are or
are
not definitions that apply to an item in your Data table. As these
definitions can be changed, I suggest that you use a form and subform to
input the information. So *tblData*
idData (Primary Key)
SomeData1
SomeData2

*tblDefinitions*
idDefs (Primary Key)
idData (ForeignKey)
Def ' Definition
DefTypeID (ForeignKey)

*tblDefTypes*
DefTypeID (PrimaryKey)
DefType

The subform would have a combobox to select the type of definition and
possibly this could indicate the report to be printed.

If you give a bit more detail of what you are trying to achive, with an
example, you may get better advice.

Phil

Thanks, I shall try!

Let's say the main form displays continuous list of people and associated
data. The key field is the checkbox which I simply call Tagged. This is
not exposed to the user in this form. When they are finished with this form
they can exit and enter another form to create reports.

In the create reports form there are two listboxes where they can move a
person from one box to the other (I don't actually get the user to change a
checkbox control, Tagged is just for my query to work). When they move i.e
select a person the Tagged field for that record is set to True.

When this happens I'm thinking that tblDefinitions is set up as I said in
my original post - copied here again;

*tblDefinitions*
idDefs (Primary Key)
selectionId (Foreign key referencing Primary key of tblData - this only
appears if tblData.chkSelection is True)


They can now run a report which shows only the selected people.

It will be tiresome to choose those people again each time they wanted to
run a report. Thus I need to capture those selections in another table and
they can access them from another form which will then run the query.

They can have as many saved reports as they like e.g List of People I Like,
List of People I Hate, List of People I'm OK With etc

My db is not actually about people but makes it less dry to talk about

Reply With Quote
  #4  
Old   
Phil
 
Posts: n/a

Default Re: A2K working out relationships between two tables - 03-16-2011 , 03:26 PM



Quote:
Maybe I'm missing the point.
It appears that you have a standard invoice header, invoice line situation
here. The checkbox appears totally redundant because either there are or
are
not definitions that apply to an item in your Data table. As these
definitions can be changed, I suggest that you use a form and subform to
input the information. So *tblData*
idData (Primary Key)
SomeData1
SomeData2

*tblDefinitions*
idDefs (Primary Key)
idData (ForeignKey)
Def ' Definition
DefTypeID (ForeignKey)

*tblDefTypes*
DefTypeID (PrimaryKey)
DefType

The subform would have a combobox to select the type of definition and
possibly this could indicate the report to be printed.

If you give a bit more detail of what you are trying to achive, with an
example, you may get better advice.

Phil


Thanks, I shall try!

Let's say the main form displays continuous list of people and associated
data. The key field is the checkbox which I simply call Tagged. This is
not exposed to the user in this form. When they are finished with this
form they can exit and enter another form to create reports.

In the create reports form there are two listboxes where they can move a
person from one box to the other (I don't actually get the user to change
a checkbox control, Tagged is just for my query to work). When they move
i.e select a person the Tagged field for that record is set to True.

When this happens I'm thinking that tblDefinitions is set up as I said in
my original post - copied here again;

*tblDefinitions*
idDefs (Primary Key)
selectionId (Foreign key referencing Primary key of tblData - this only
appears if tblData.chkSelection is True)


They can now run a report which shows only the selected people.

It will be tiresome to choose those people again each time they wanted to
run a report. Thus I need to capture those selections in another table and
they can access them from another form which will then run the query.

They can have as many saved reports as they like e.g List of People I
Like, List of People I Hate, List of People I'm OK With etc

My db is not actually about people but makes it less dry to talk about

I suspect you need 2 more tables
TblQualities
QualityID Primary Ket
Quality (I Like, I hate etc)

TblJnDataQuality
QualityID Joint Key
IDData JointKey

Then each person can have as many qualities as you like, and similarly, if
you select a quality, then you get a list ov everyone that applies to.

Phil

Reply With Quote
  #5  
Old   
buckskin
 
Posts: n/a

Default Re: A2K working out relationships between two tables - 03-16-2011 , 09:37 PM



"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote


Quote:
I suspect you need 2 more tables
TblQualities
QualityID Primary Ket
Quality (I Like, I hate etc)

TblJnDataQuality
QualityID Joint Key
IDData JointKey

Then each person can have as many qualities as you like, and similarly, if
you select a quality, then you get a list ov everyone that applies to.


That first table sounds like my tblDefinitions and then the second is a
linking table. Is this many-to-many? This is what I'm trying to see if I
need and I'm still not sure. At the moment I'm just thinking of copying the
ids of the selected rows to tblDefinitions with an update query or bit of
DAO

Reply With Quote
  #6  
Old   
Phil
 
Posts: n/a

Default Re: A2K working out relationships between two tables - 03-17-2011 , 03:16 AM



On 17/03/2011 03:37:09, "buckskin" wrote:
Quote:
"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message
news:ilr9ut$kev$1 (AT) speranza (DOT) aioe.org...


I suspect you need 2 more tables
TblQualities
QualityID Primary Ket
Quality (I Like, I hate etc)

TblJnDataQuality
QualityID Joint Key
IDData JointKey

Then each person can have as many qualities as you like, and similarly, if
you select a quality, then you get a list ov everyone that applies to.



That first table sounds like my tblDefinitions and then the second is a
linking table. Is this many-to-many? This is what I'm trying to see if I
need and I'm still not sure. At the moment I'm just thinking of copying
the ids of the selected rows to tblDefinitions with an update query or bit
of DAO


Cetainly the second table is a many-to-many. You're telling me that each
record in your Tbldata can have a number of definitions, so that is what you
need. Your reports seem to want to be in the form of who belongs to a
particular defination, so again you need the Many-to-Many table Phil

Reply With Quote
  #7  
Old   
buckskin
 
Posts: n/a

Default Re: A2K working out relationships between two tables - 03-17-2011 , 07:24 PM



"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote

Quote:
On 17/03/2011 03:37:09, "buckskin" wrote:



Cetainly the second table is a many-to-many. You're telling me that each
record in your Tbldata can have a number of definitions, so that is what
you
need. Your reports seem to want to be in the form of who belongs to a
particular defination, so again you need the Many-to-Many table Phil
Thanks, I'm still trying to parse all this, finding it confusing but that
sounds reasonable,

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.