![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |


#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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. |
#6
| |||
| |||
|
|
"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 |
#7
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |