Tables :: Change Record That Is Part Of Composite Key?
Feb 26, 2015
I am creating a database that tracks the selling of products amongst other things.
The user will enter in an order and may delay invoicing until the customer approves the quote - at which time the order is turned into an invoice.
In the transactions table the OrderID, ProductID and CustomerID constitute a composite key.
I want to be able to view the order and change it by either deleting or adding ordered items (obviously prior to invoicing) but because the ProductID is part of the composite key I cannot delete a line item.
Perhaps the solution is to remove ProductID from the index or is there a better way?
View Replies
ADVERTISEMENT
Oct 17, 2014
My table key looks like this. Its a table that keeps a master record of conferences that occur during a calendar year
ConfYear (Date/Time) primary key
ConfNo (Byte) primary key
As you see its a composite key. Now each time a new record is created i want the ConfNo to autoincrement within its ConfYear. I used a byte as its not usually more than 4. Autonumber does not work as part of a composite key i found out.
2014 1
2014 2
2014 3 etc
And revert to 1 when ConfYear input changes to 2015
Is there a simple way to do this with say, a macro, or is the only way with VBA and DAO?
View 12 Replies
View Related
May 10, 2013
I'm creating a database for a school. it contains the following tables: 'Students' of which the primary key is StudentID, 'Subjects' of which SubjectID is the key and 'Exams' - ExamID.
Then, I have a table called 'Results' but with no primary key of its own - just 3 foreign keys from the other tables and another field which can be left blank let's call it 'Grade'. So the Results table would have the following fields:
StudentID*, SubjectID*, ExamID*, Grade
Now, I make a form which creates a new lets say ExamID and I would like to create records with all the combinations of all of the subjects and students, ready for the 'Grade' to be typed in.This is assuming the Exam isn't based on the Subject directly.
View 1 Replies
View Related
May 10, 2013
I have a table of the following structure:
Key 1 Key 2 Key 3 Optional
data1 data2 data3 data4
The 'key' fields are a composite key of primary key fields from other separate tables. I have a form that generates a new 'Key 1' record and I would like to make a query that creates all possible 'Key 2' and 'Key 3' results (new combinations) while key 1 stays the same. How would I go about doing this? I know I can be done.
I cannot really give any real data as I haven't received it yet.
View 4 Replies
View Related
Oct 22, 2012
Currently I keep getting this error: "You cannot add or change a record because a related record is required in table"..My current tables are this:
Primary Table with persons info:
Primary Key - Auto number generated
Name
Address
Email
Phone
I have 4 other tables with use check boxes.
ex:
Table 1 - Geographic locations visited
ID - Auto generated
USA
CANADA
ASIA
ECT...
Table 2 - Languages Spoken
ID - Auto generated
Spanish
Chinese
English
Table 3 - Skills
ID - Auto generated
Hunting
Dance
Singing
Weaving
Is this not a genuine one-to-one relationship table? I mean No two people would have had visited the same places and speak the same language no? I tried to create a one to one relationship with the primary key to the auto generated ID of the child tables but I'm sure that is not how you do it. Also when I try to save the check boxes in my form and I close it and come back it doesnt save and is blank again. Is it because my form gets its information from a query that takes all the information from all the tables.
how I can get this to work properly? Am i to make use of a foreign key? I've read a lot about it online and watched youtube videos but I dont see why I need it here in this case. Is there a way to set the IDs in the child tables to be the ones from the primary table? Or do I have to use a foreign key and manually input the primary ID into them?
Or would it be better to have all these child tables in the primary table and have one large table instead? I just didnt do that because one of them has like 20 checkboxes with cities and locations
View 12 Replies
View Related
Jun 2, 2013
Composite Primary Key in Ms Access 2010. I shall try and explain my tables in detail. So my first table is "Client Database" where the field "Buyer" is primary key. This is connected to my next table "Project Database" which has fields such as Work Order #, PO #, PO Date , Buyer etc where Work Order # is the primary key. Finally "Projects Database" is connected to Order information. Now the problem is until now, I always had 1 PO # for each Work Order #. However now I am facing a situation where my client has clubbed multiple PO #'s for the same Work Order #. I need to trigger the Primary Key Violation only if both the Work Order # and the PO # are the same.
View 8 Replies
View Related
Oct 3, 2007
Hi,
I am trying to join 2 tables with composite keys - each of them have the same 4 columns as part of its key - date/person/problem/date sent.
Table 1 has 5 columns (4 key columns + 1), Table 2 has the same 5 columns plus 1 additional column (Comments).
I am trying to match the Comments column in Table 2 to Table 1 and show the output in another table.
Currently, I've related the 4 columns in each table to each other, each relationship defined as including all records from Table 1 and only the records from Table 2 where the fields are equal.
In the fields, I have 5 Columns from Table 1 and the last column (Comments) from Table 2. When I run the query, I get all the records from Table 1, but not all of the Comments that match from Table 2 are shown.
Any Ideas on how to improve this link?
Thanks!!!
View 7 Replies
View Related
Jun 17, 2015
I have an events table and a junction table that has a composite key with two fields; those are the only fields on the junction table and are FKs in my events table.
I have a form that fills in events to my events table and also fills in values to my junction table. The control source is a query of the two tables along with a couple of other reference tables for metadata associations. The form works fine... the first time. My problem is that, after I have entered an event that has my unique composite key for the first time (thereby entering a new record to my junction table), once I go to enter a second event that uses the same key, access tries to enter the record again and throwing a "3164: field cannot be updated" error instead of referencing the already created composite key.
I have the form set the composite values to the selected values on form load. Normally, I would just set the primary key to the primary key values and access would follow my logic, but in this case it always tries to make a new record.
View 5 Replies
View Related
May 17, 2007
I am creating a bridge table to get rid of redundant data. I am doing it by making a composite of the primary keys from the two tables I am bridging.
The error message when I get to a certain point is "You cannot add or change a record because a related record is required in table tblMachCent." Both the numbers I am using to create this composite key are in the tables necessary, so I am not sure why I am getting this problem. Any suggestions??
View 1 Replies
View Related
Nov 11, 2007
Given a table field that is a hyperlink type.
I need an Update Query to set all records of that table so that the Displayed Value part of the hyperlink field (not the Address part) is set to a particular value.
Any ideas how?
Thanks.
View 1 Replies
View Related
Mar 4, 2014
I have a training database that I have set up and utilize to track attendee data and who is registered to which course.I have a course registration table that has a course title field which is a drop down list populated by course titles from the courses table, and a trainee id field.
For whatever reason, when I view reports or queries that draw from this table, access will make changes to the first record in the course registration table course title field i.e. it will take whoever is in the first record, and change the course they were registered to.
View 10 Replies
View Related
May 27, 2007
Hello. Im new here and also new to both Visual Basic and Access so please be patient with me :)
I've downloaded SearchDB.zip uploaded by agehoops. Its works exactly like its supposed to but I need to update it a bit.
Im making a MovieDatabase and have a table with Orginaltitle, SwedishTitle, Director, Actors and so on. When I search in "Director" for "Francis Ford Coppola" or just "Francis" the movies which is related to him comes up. But when I search for "Ford Coppola" or only "Coppola" nothing comes up. I want the user to have that possibilty to search using the last part of the name too. Is that possible?
When searching with the binocolor icon it works fine when chosing "part of record", i think thats the english translation for "Del av fält". I have a swedish acces version so im not so sure but anyhow I think you understand what I mean.
To sum it up I want the ability to search writing only a part of what the record contain including the last part and not only the first part like it is right now.
Appreciate any help!
Regards,
SoloJuve
View 6 Replies
View Related
Dec 16, 2004
I have what I think is a difficult problem to overcome...
I am designing a form to create an invoice. The user will select a workstream and a date range in form frmInvByHrs. Within this I want two sub-forms, one is frmInvByHrsTsht and the other is frmInvByHrsBill. I want the first one to display all the staff and their hours done, and the second one to be in data entry mode where you can enter the hours you want to bill. Each sub-form is based on a separate query.
Is it possible to do this? ie. to have one sub-form in data entry mode, and the other not? It seems to me that the data entry mode is controlled by the MAIN form regardless of the sub-form settings!
If this is not possible, do you know how I can acheive this?
Thanks
S
View 1 Replies
View Related
Jul 22, 2005
Hi,
I think I know my way around a database, but my new employer has me doing kart-wheels. There is an Excel sheet of values which I have imported to Access tables, the table contains ledger values on it and the account numbers are in the fields as column headers.
I want to reflect those field values as part of the actual record in a summary query.
I think this can be done with just a few steps without creating more than one table or query???
Please help. :cool:
View 7 Replies
View Related
Dec 14, 2006
Im using the UPDATE Query in Access
UPDATE MAT_Clean SET FCODE = 'BC', NOTES = 'HC RAMP'
WHERE FCODE='BC HC RAMP';
Instead of typing what needs to go into NOTES everytime, how can I specify whatever comes after 'BC' to go into NOTES? Use 'BC *'?
Thanks!
View 5 Replies
View Related
Aug 2, 2007
I am pritty new to access and have been tasked with creating a database !
I have two tables one called main which has 26,000 claims (listed under there part number).
The other table called part numbers is a list of all the part numbers in the main table but with no duplicates (126 part numbers)
I need to somehow count how many times a part number apears in the main table. Maybe display a count in the part number table as a extra field ? then i could put this field into the form i created to browse the parts numbers (to show how many times the part number appears in the main table)
View 12 Replies
View Related
Apr 26, 2005
Hello everyone. I'm pretty new to access and need some advice on table structure for a new project I've been given.
One of our customers sends us an Excel spreadsheet each week containing their order. Currently, someone formats the spreadsheet, prints it out, and manually picks out the products we need to ship. I want to import this into an Access table. Basically, the sheet with some data examples looks something like this:
CONTRACT_NUMBER----PRICE----COMPONENT----LOCATION----SHIP_DATE
----------------------------------------------------------------
11111111-----------393.67---AAA1000------290---------4/29/2005
22222222-----------415.00---ABB2000------310---------5/1/2005
There are usually 30-40 records on this list. The COMPONENT field is actually a part kit. We have tables in a Excel sheet that list the parts in the kit as well as the quantity. For example.
Component: AAA1000
will contain
Part#---------Quantity
----------------------
123-----------2
456-----------17
789-----------11
111-----------57
908-----------36
--------------------------------------
Component: ABB2000
will contain
Part#---------Quantity
----------------------
123-----------80
777-----------29
345-----------3
906-----------14
What I basically want to do is run a report based on a query where each page has a contract number (one for each record) with matching ship date and location information and a list of parts needed on that kit.
For example, the first page would be:
--------------------------------------------
Contract #:---11111111
Location:-----310
Ship Date:----5/1/2005
Kit-----------AAA1000
Part#---------Quantity
----------------------
123-----------2
456-----------17
789-----------11
111-----------57
908-----------36
--------------------------------------------
and the second page would be:
--------------------------------------------
Contract #:---22222222
Location:-----290
Ship Date:----4/29/2005
Kit-----------ABB2000
Part#---------Quantity
----------------------
123-----------80
777-----------29
345-----------3
906-----------14
--------------------------------------------
I'm a little confused by the COMPONENT field linking to more than one part. In the little experience I've had with Access, one record was always linked to just one other record in another table. Also, I want the Contract Number, Location, Ship Date, and Kit # show up once at the top and the complete kit show up below.
I would appreciate any suggestions as to hot to set up my tables. We have about 30 different kits. Should I have a separate table for each or a huge table? Also how will I make relationships between the main table and the part table/tables? Am I going to have to have the kit # as a field in the part table and list it for every part/quantity record? I want to just list the description information (location, ship date, etc...) only once while listing all the parts and quantities for the kit.
I've only been using Access for a short time, so this might be a really simple question. I just need to be pointed in the right direction, so I can set the system up the right way. Any information would be greatly appreciated.
Thank You,
Chad
View 1 Replies
View Related
Nov 24, 2007
Could you answer a diabolical question? I am trying to track the changes of a record in a table when I have imported a text file.
I will import a txt file everyday and to that end I have wrote the code for the insert of new records into customer table and customer history tables and then the updates into the customer table.
However I will only be able to capture the updates in tables as there will be multiples. I understand that Jet can't capture the updates at the table level (no triggers).
So the diabolical question, is it possible to capture the updates only in tables using code??
Please help...
Many thanks
View 1 Replies
View Related
Jun 25, 2013
I have just inherited a database that currently has no primary key set up. I wanted to add a two part primary key, but have run into a couple problems. The purpose of the database is to keep track of parts that have come back for repair. I wanted to set the key up to be a combination of the call number and the part serial number. I should always have a serial number, but the serial number can be in the table more than once, as it could have needed repaired more than once. I will normally have a call number for each record.
However, the call number could be repeated more than once, if more than one part came in on the call. The combination between call number and serial number should always be unique (each time a part comes in, it should be on a different call). My problem is arising, when a part is just pulled off the shelf of the factory and sent in for an upgrade. In a case like that, there is no call number. However, a serial number will never come in more than once without a call number.
So the combination of call number and serial number should still remain unique. When I try to set this up in the database, it tells me that the primary key cannot contain a null value (referring to the times that a serial number comes in without a call number). I want to get this set up so that the people entering data in the database will not be able to enter the call number, serial number combination more than once. How can I do this if one part of the primary key can be null?
View 5 Replies
View Related
Aug 13, 2013
I am needing to compare some information in a way I cant with the normal Unmatched Query.
I have 2 tables with the fields:
| PHONE1 | PHONE2 | FIRST | LAST |
What I need to do is have Table 2 check against Table 1 to see if any of the 'PHONE1' records match 'PHONE1' or 'PHONE2,' and if they do have them remove just the information from PHONE1, not the entire record.
Then I would have to repeat the process to do this with PHONE2. Having it check against 'PHONE1' and 'PHONE2' in Table1.
If both PHONE1 and PHONE2 have a match, the entire record would be deleted. If not, it would keep whichever did not match.
I am currently having to do this manually, because if I just run an Unmatched Query it gets rid of the whole record regardless of if PHONE2 is a good number or not.
If any more information is needed, let me know. Like I said, Im relatively new to working in Access and dont know much.
All of the fields are 'TEXT' type.
Access 2003 on Windows XP.
View 8 Replies
View Related
Apr 6, 2015
I have two tables (A) and (B).
Table (A) contains key-field name "position1".
table (B) contains key-filed name "position2".
How to make a link between key-field "position1" and part of key-field "position2".
View 5 Replies
View Related
May 28, 2013
I have a table with data like this
Field_1,Field_2,Field_3
A,B,5
A,B,3
A,C,7
A,C,6
X,Y,4
X,Y,3
I need a report where I can only see
A,B,5
A,C,7
X,Y,4
That is Group by Field_1 and only show the records which has Field_2 with the max. value of Field_3
View 1 Replies
View Related
Nov 3, 2006
Hi everyone,
I have refined my query from previous threads to involved a module function. This calculates more acurately no of working days between dates and takes into account a holidays table. (All credit to Arvin Meyer on the module:) )
However because the Leave Year starts at the 1 July and finishes 30 Jun I need to compose the date for any current year Year(Now())
Enclosed scrdmp shows my query design. I can easily get it to work as you see it, but obviously as each year rolls over, the year needs to change.
Have looked at many posts but can't find what I'm looking for. This one will get me over the hurdle.
Many thanks,
View 6 Replies
View Related
Nov 14, 2012
I have a master list of projects, with project reference number, project name, and nature of project.
I have also got a form for individuals to fill in details of project events, with date, time, name, and two or three other fields - also included are project reference and name. I'd like the name field to be auto filled when the user selects the project reference from a combo box; I think? (the list only shows open projects).
I'd did something similar some years ago in Access 2003 (I think) but cannot figure it out in the version I'm currently using 2010.
View 8 Replies
View Related
Aug 1, 2006
Hi! Please help!!!
I'm currently building a bookings database and have encountered an alert message that I cant seem to rectify -
"You cannot add or change a record because a related record is required in the table 'Booking Details'"
Basically - I have a 'Customer Database' form that is linked (via command button) to a 'Booking Details' form. Within 'Booking Details' I have 2 sub forms - 'Booking Quote' and 'Booking Payments'. Both subforms are linked to the 'Booking Details' form by the 'booking ref' field with RI.
I have no problem updating information in the 'Booking Quote' subform, but when I try to add information to 'Booking Payments' it states the above message.
Can anyone please advise as to how I can prevent this happening? I'm slowly losing my mind....!!!
Many thanks,
Stacey
View 10 Replies
View Related
Feb 22, 2015
I have created three tables, all of them are connected by one-to-one relationship by same field, as you can see in the screenshot. and at the same time I have created three forms for each table. then I brought two forms in one remaining form. so whenever I entered data in first form and click on the next tab in which another form exist, it gives me this error: "you cannot add or change a record because a related record is in table".
View 2 Replies
View Related