How Do I Create A Table That Contains All Records From Two Others
Jul 11, 2005
I'm trying to create a table that automatically contains records for every permutation of the two foreign keys it imports. Let me explain with an example:
I have a Characters table:
CharacterID (Primary Key)
CharacterName
CharacterClass
[...]
And, I have a Skills table:
SkillID (Primary Key)
SkillName
SkillDescription
[...]
I want a third table named CharacterSkills to combine those two tables. It might look like this:
CharacterID (Primary Key)
SkillID (Primary Key)
CharacterSkillSlot
[...]
That looks a lot like a junction table for a many-to-many relationship. The difference is I want this table automatically filled with every combination of Characters and Skills. For example, if I have three characters and five skills this table would contain fifteen records. If I add a fourth character I'd expect this table to grow by another five records (as one record per skill is automatically added).
Here are those same tables with some example data.
Characters table:
CHR01, King Loo, [...]
CHR02, Humble Pie, [...]
CHR03, Jayne Bo, [...]
Skills table:
SK01, Amity, [...]
SK02, Diversion, [...]
SK03, Banish, [...]
SK04, Guilt, [...]
SK05, Shame, [...]
CharacterSkills table:
CHR01, SK01, [...]
CHR01, SK02, [...]
CHR01, SK03, [...]
CHR01, SK04, [...]
CHR01, SK05, [...]
CHR02, SK01, [...]
CHR02, SK02, [...]
CHR02, SK03, [...]
CHR02, SK04, [...]
CHR02, SK05, [...]
CHR03, SK01, [...]
CHR03, SK02, [...]
CHR03, SK03, [...]
CHR03, SK04, [...]
CHR03, SK05, [...]
Any pointers on how to create this magical third table, or whether it' possible at all, will be greatly appreciated.
View Replies
ADVERTISEMENT
Nov 9, 2007
Hi,
I have a database that contains a table with an administration area and a number associated with the “count” of a certain characteristic of that area.
For use in another piece of software I need to convert the count system to individual records. For example I need to go from:
AREACOUNT
AdminArea13
AdminArea22
AdminArea31
AdminArea43
...
to:
AREACOUNT
AdminArea13
AdminArea13
AdminArea13
AdminArea22
AdminArea22
AdminArea31
AdminArea43
AdminArea43
AdminArea43
AdminArea43
I actually don’t need to count field in the new table, but it would be useful for my own quick reference.
The problem is that I do not have the original raw un-aggregated data – otherwise this would not be a problem. Also there is no way I can get this.
I realize that this is working in the opposite way to good normalised databases – however as I said the software that I need to export requires this data in the expanded format.
Does anyone know how I could run a query in access to achieve this?
I have large tables so will need to do this programmatically rather than manually.
Many thanks in advance.
Regards,
Kevin
View 1 Replies
View Related
May 23, 2006
Where a many to many relationships is resolved with a linking table...Is it possible to create an entry in the linking table where the two linked tables have the same value e.g. create a entry in the linking table where client table has same value as a job profile table i.e. both are in insurance. Therefore want to create an entry in the middle table with foreign keys from either link automatically
ta
View 1 Replies
View Related
May 21, 2013
I need to create some new records based on main form data and a selection of records from a sub form. The main form and sub form have different sources. I wanted to show the source fields in the sub form along with a check box to allow the users to select individual records. The record source for the sub form contains >1000 records, so the user will first enter data in the main form, use filters to find the records he wants to 'assign' to the main form data, click those he selects, then click a command button in the main form to create the record(s) based on the main form data and the selected records from the sub form. The new records will be appended to a new table.
View 6 Replies
View Related
Jul 10, 2012
I think what I want is:
1 table(1): record of people & contact details
1 table(2): list of events with check box's with the names of people from the other table
1 report: listing how many events people have attended.
When I add a new person to table 1 I want a field to be added to table 2 in the form of a checkbox, also when I delete this person I want this field to be deleted in table 2.how to make this an automated process.
View 1 Replies
View Related
Nov 18, 2004
Can someone direct me as to the most efficient way to add records to a table from a form? I have a table of members and a table of invoices and want to automatically create an invoice for each member by clicking a button on a form. Is there a way to do this using a macro, query, or do I write it in VBA?
Thanks much!
View 6 Replies
View Related
Mar 25, 2008
I have a problem and not sure what the best approach is.
Our study enrolls patients and then re-contacts them every month for 1 year. I want to create 12 new records in "Table2" based on the "baseline_date" and "StudyID" of each patient in "Table1". "Baseline_date" is the initial date the patient is enrolled in the study and "StudyID" is a number created based on information from the patient. Both are unique values. What I want to do, is after the "baseline_date" variable is updated with the date of enrollment on a form I want to trigger VB code to automatically create 12 records in "Table2". "Table2" would have the following variables: "StudyID", "Early_Date" and "Late_Date". The records would be created based on the following.
Record1{"StudyID", "Early_Date=(baseline_date+30)-3", "Late_date=baseline_date+30)+10;
Record2{"StudyID", "Early_Date=(baseline_date+60)-3", "Late_date=baseline_date+60)+10;
Record3{"StudyID", "Early_Date=(baseline_date+90)-3", "Late_date=baseline_date+90)+10;
Record4{"StudyID", "Early_Date=(baseline_date+120)-3", "Late_date=baseline_date+120)+10;
Record5{"StudyID", "Early_Date=(baseline_date+160)-3", "Late_date=baseline_date+160)+10
......
Record12{"StudyID", "Early_Date=(baseline_date+360)-3", "Late_date=baseline_date+360)+10
The -3, +10 gives us a two week window in which to contact the patient. "Table2" containing the newly created records will have a many to one relationship with "Table1".
Any help would be much appreciated.
View 2 Replies
View Related
Sep 25, 2014
Is it possible to define 2 dates and create a record for each day in between? I am creating a "sick occurence" database. I want to define the first day the individual calls off sick and the day they will return, then calculate how many sick days they will be using. However, I need to take into consideration any relief days or assigned time off.
Basically, I want to be able to assign what is going on everyday between these 2 defined dates. Be it, holiday, annual leave, personal leave, sick leave, or regular relief. If further clarification is needed, I can go more in depth.
View 9 Replies
View Related
Apr 11, 2006
I have searched, but found no reference to my exact question. I have a list of drivers I need to create a checklist for each day. The Parent form is the day and the subform is the list of drivers. What I would like to do is have a command button automatically enter all the drivers that are active (denoted by a chechbox) into the tabular subform.
View 14 Replies
View Related
Jan 20, 2006
HI!! I've a problem
I have a table with 10 records
I would create many pages html how many are the records :eek:
better still if every page with a various name
It's possible? :confused:
thanks!!! :o
View 14 Replies
View Related
Aug 12, 2007
Hello
there is a field in my form named "numphotos" and I write the number of photos than that folder contains.
I have a subform in that main form named "descriptions", here I describe, one for one, all photos of that folder.
Itsn´t a problem if the folder contains a few photos, but I have folders that have even 100 photos :confused: then I must to create 100 records in my subform :eek:
I would like than Access create those records automatically according to the number of photos that I indicate at the field numphotos.
My example in photo: http://farm2.static.flickr.com/1141/1093088982_a084bff95f_o.jpg
I only would desire that Access create that many lines to me as I have written on "numphotos". I would write the rest of the information (photographer and description)
is it possible?
thanx!!
windowsXP
access 2007
View 5 Replies
View Related
May 17, 2005
hi,
I am trying to write a training register DB for my department basically:
There are three tables: trainees, training sessions, and trainees on courses.
The training sessions will be mapped out in advance: so that's easy we will plug in the training dates when necessary.
the tricky bit is the booking form for trainees. I'd like a form/subform where the trianing session info is at the top and the subform lists trainess for that day.
Now here's the rub. we may not have the trainee's name in our database already so I created a combo box with the all the known trainees. This way if they exist their details pop up and we have a new "trainee on course" record for them.
So what I need is a macro or some code that will check whether they exist and if not create a new traineee record and then allow us to fill out the booking form. Perhaps I'm rusty and not thinking this through properly.
I'[ve attactched the db in case anyone needs a visual. I'd be grateful for any suggestions
The problem is when we get a new trainee with no history we cant create them. either I have
View 3 Replies
View Related
May 23, 2005
I have a form which a user selects an activity from a combo box. On some occasions a user may need to enter the same activity a number of times. I want to add a text box/combo box that a user can enter or select a number. When the user hits the submit button i want the records created in the database to match the number specied fied in the text/combo boxes.
I think i may need to use an INSERT statement but totally confused how to do this.
View 6 Replies
View Related
Mar 30, 2006
I guess this is a fairly basic one. I have a form that allows people to edit records, but I want to prevent people from adding new records on this form. I thought that if I put 'no' in the 'Allow additions' property, I would achieve this end, but when I do this, all the input boxes dissappear.
appreciate help
thanks
View 2 Replies
View Related
Nov 19, 2004
I have a database with over one hundred employees in. Attached to each employee is a relationship where they can do many activities. How can I automatically create one activity record per employee at the beginning of a day and give the date field in the many part of the relationship the current days date.
I assume you've got to create a recordset and do something along the line of - do until EOF docmd.acrecnew.
But haven't got a clue where to start.
Pease help,
Recall.
View 4 Replies
View Related
Jun 19, 2012
I have three tables:
tblClient (for basic client information),
tblDischarge (for client discharge information), and
tblAppointments (for appointments that are added to an outlook calender).
All three tables are linked using the IDNumber from the Client table. I have a form where a user inputs a discharge date for the client.
Once that date has been added I need to add 5 records to the Appointments table for different followup times based on that discharge date (such as one month, two months, three months, etc.).
I have the code working to add an individual appointment to outlook but not 5 different ones at one time. So the question I have is how to add the 5 records based on the one discharge date?
View 1 Replies
View Related
Jan 5, 2012
I am relatively new to Access and have a simple database which I use to generate Publication numbers for our new publications. I would like to have a text box and button on a form that will generate duplicate records of the current record the same number of times as specified in the text box.
E.g. If I need 6 copies of a record I would like to enter 6 in a text box, click a command button that will generate 6 duplicates of that record.
The code in order to do this 'on click'.
Table = Publications
Form = Publicationsfrm
Text Box = Lines
Command Button = Submit
Primary Key = PublicationNo
I have tried the following code but it is not working.....
Dim i as Long, myRS as Recordset
Set myRS = CurrentDB.OpenRecordset("Publications")
For i = 1 to Me![Lines]
With myRS
.AddNew
![PublicationNo] = Me![PublicationNo]
.Update
End With
Next
Alternatively if I have a duplicate record button that uses a macro is there a way to run that macro the specified number of times in the 'Lines' text box.
View 14 Replies
View Related
Mar 4, 2015
I am looking for a query that will return records from a table that have related records in another table. Opposite to the Unmatched Query Wizard.I have two tables: tblSupplier and tblSupplierProducts.The two tables are related by the field "SupplierId".I need the query to only return Suppliers that have Products.
View 3 Replies
View Related
Nov 4, 2014
I have a make-table query that pulls all the fields from 1 table (MainTable), and creates a new table with a date stamp based apon a form value entered (New Table = MainTableWithDate).
Currently, I setup the query to pull info from the form field like this:
DateField: [Forms]![frmmain]![DateField]
However, when the make-table query is done - all date fields are blank (all other fields are correctly created), and when I look at the new created table (mainTableWIthDate), the typeassigned to the date field is "Binary" (in the form, I've specified LongDate).
View 6 Replies
View Related
Jun 4, 2015
I have three tables that contain different columns but linked by a primary column call Name. I want to create a table where all these different columns in the three tables join to form a master table which can be updated regularly either through the master table or the smaller tables. The master table also has the primary column as Name.
If I update the master table with records, it should update the respective linked table and vice versa. I also want to link these tables to my SharePoint site.
Note: except the Name column, none of these tables have any other columns in common How do I go about this?
View 7 Replies
View Related
Nov 26, 2014
I have a table with an empty column called ActionID. I need to generate a numerical number that begins with 5000 and goes up by 1 number on each saved record. I have a basic form that links all of my other field to the table except the one I need to generate (ActionID) but will need that number saved to the table once its created.
View 11 Replies
View Related
Apr 8, 2015
I know this has probably been gone over, but I'm just looking for a super-simple way to put a button on my form that will create a number of records equal to the number of days in the month listed in a field. For instance, if MyField is "4/1/2015", I'd like the system to create one record for each date between 4/1/15 and 4/30/15.
I have scoured the forums, and I find many threads on creating multiple records, but none of them deal with the same type of thing I need. I have a field, called MyField, and I have a table called MyTable with a column called MyDate. I want to enter a date into MyField, then click a button, and the button will run code/macro/whatever that will create multiple rows in MyTable, one for each date in Month([MyField])
View 8 Replies
View Related
Jul 24, 2014
I am trying to create a query in Access 2010 for records that don't match based on the following criteria. I have two tables with identical ID's and I need to do a comparison on the amount field between both tables and only return the records from one table displaying all fields plus the amount fields that do not equal. I tried this in the wizard unsuccessfully.
View 13 Replies
View Related
Mar 21, 2014
See attached picture where I am stuck at?
I have a table that holds UK Postcodes and a customer table that holds customers.
I am trying to create a relationship between the 2 so when I enter a postcode in the customer table this is then related to the postcode table.
The main problem I have is that there is a lot of duplicate postcodes in postcode table so the primary key is simply a number as you will see in the picture.
View 2 Replies
View Related
Mar 19, 2014
I've developing a QA/QC database for testing chemical products and I'm stuck on the best way to continue with adding multiple records by using one form.
I have two tables:
tblProductSpecs with two primary keys, "ProductName" and "TestName"
tblResults with three primary keys, "ProductName", "TestName", and "LotNumber" and a number field named "Value"
A product can have multiple tests associated with it, e.g:
ProductName - TestName
XXX - Density, pH
ZZZ - Density
YYY - % soluble, cloud point , freeze point
This is my tblProductSpecs table
I want to store the "Value" of each "TestName" of the "LotNumber" of that "ProductName" in tblResults by a form. (All TestName values are number values).
I want a form where I can select "ProductName" and have the "TestName"s displayed for that "ProductName". Then I want to store the value of that "TestName" for that "ProductName" and "LotNumber" in tblResults.
The problem is that each test per product per lot number is a record and I can't figure out a way to create multiple records from one form.
View 14 Replies
View Related
Dec 24, 2013
How do I create new records based on the results of a query?
I opened the query results in a form then I want to have a button that basically creates new records based off the query data ... is this possible?
View 1 Replies
View Related