Related Records

Aug 28, 2007

I've been using an access d/b for ages, it's one of the template (Orders) databases included with access but modded to suit my own use. copy attached with customer details removed.

Last time I used it it worked fine but yesterday, when I tried entering order information, I get an error saying cant add or change a record because a related record is required in table orders.

Can anyone shed some light on the potential problem? Bear in mind I'm not an advanced user and have very limited knowledge on relationships in access.

Thanks in advance.

Marc

View Replies


ADVERTISEMENT

Queries :: Mass Duplicate Main Records And Related Subform Records

May 29, 2014

In my simple database (attached), I need to mass duplicate Tasks and their Notes.

I have three tables: tbTasks (PK: Task_ID), tbNotes (PK: Note_ID), jtbTaskNotes (FKs: Task_ID and Note_ID). jtbTaskNotes is my many-to-many junction table that ties Tasks to Notes.

The main form (fmTasks), bound to tbTasks, has a subform (sbfm_TaskNotes) that displays notes associated with each Task. On themain form,you select which Tasks you want duplicated via a checkbox. The append query (quCopyTasks) will duplicate all tasks that have the checkbox checked. All good there. However, I can't figure out how to also duplicate each task's Notes.

I found Allen Browne's solution [URL] ....., but that only handles duplication of one record at a time, whereas I need to duplicate many records at a time (sometimes 10+ records). How do I go about duplicating multiple Tasks and their associated Notes?

Before you ask "why are you duplicating records?": There are times when tasks need to be re-accomplished and therefore need to have a new record. It's easier to duplicate records than it is to hand-jam everything again.

View 5 Replies View Related

First/Last Of Related Records

Oct 13, 2005

The "last" total in an Access query is unpredictiable. I have a Journal, with the main form/dataset being linked to the entries of that day. I would expect the 'last' total word to give me the last entry of that day, ie. what I ate for supper. But in the two qrys shown, it does the opposite. What is the most relable way to get the last entry of that day (ie. the one with the highest journalID)? :confused:

Sample Database attached.

View 7 Replies View Related

Min Value And Related Records

Oct 29, 2005

Hi,

i need a query to return the first orderdetailsID and related productsID, so that all the other products that are the same as oldest order can be manufactured together.
In access help menu it shows it would be something like using the criteria under productname1 field:
(SELECT [productname1] FROM [the next one to cut query] WHERE min([orderdetailsID]))
But this returns an error cannot have aggregate function in where clause
min([oderdetailsID])).

I've also tried with 2 queries, 1 with the min function and the using inner join, but can't get it to work.

Thankyou

View 4 Replies View Related

Related Records

Jan 18, 2006

Before I spend an age trying to get this to work I thought I'd consult some experts.

I have a main data table for recording all possible insurance claims against a company. What I want to do is create say 2 incidents but link them in some way. i.e. One of our drivers had a car accident (1 claim against our motor policy), but then the driver of the other car sues us(1 claim against our public liability).

I can create 2 seperate records and maybe have a field to highlight parent/child reference numbers, but is there anyway I could allow the user to click a button and see the related records simultaneously?

Cheers

View 2 Replies View Related

Help Find Related Records.

Apr 27, 2005

Hi
I'm have created a video database with a genre field. Is there a way that when i click a button a list is displayed of all the records which are the same genre?
Thanks
Aden

View 1 Replies View Related

Counting Matching Related Records

Sep 30, 2007

Hello there,

I have tables like so (simplified):

-=Holiday=-
HolidayID
Name
Date

-=Booking=-
BookingID
HolidayID
ClientID

What I would like to do is create a query which returns a list of all the holidays with a field showing how many bookings have been created for each holiday. This almost works:

SELECT Count(1) AS CountOfBookingID, Bookings.HolidayID
FROM Bookings
GROUP BY Bookings.HolidayID;


...but it does not display holidays where there are no bookings.

Is it possible to create one which will show all holidays even if there are no bookings?

Thanks!:cool:

View 3 Replies View Related

Button Deletes All Related Records - Help!

Feb 20, 2005

I have a problem where a button is deleting all the records related to one record, I was hoping somebody could help. Here's the problem:

OrderID is an attribute in table tblOrders. It is related (with Cascade update related records) to OrderID in tblTurkeys. In a form with a button which deletes a particular OrderID from tblOrders, when this button is clicked, if there are records in tblTurkeys with that OrderID, the record in tblOrders cannot be deleted. And if I changed the relationship type to cascade delete, the record in tblTurkeys will be deleted. Basically, I want the button to, before deleting the record in tblOrders, make the value of the OrderID attribute of any records in tblTurkey with the same OrderID as the one being deleted to have no value.

Eg. Record in tblOrders is being deleted. It's OrderID is 2. There are two records in tblTurkeys which have OrderID attributes of value 2, so when the record in tblOrders is being deleted, the values of the OrderID attributes previously mentioned as being in tblTurkeys now have no value.

That's what I need it to do! If anyone can help, I'd be greatly thankful!

View 5 Replies View Related

Adding Records To Related Table

Sep 28, 2006

Hello I need to add daily records to a related table using a form, from a button or subform displayed on a form updating the master table.
This would enter the related key to the new form ready for insertion etc.
Can this be done?

For example

Master table:
Key 1


Related table:
1 Key 1
2 Key 1
3 Key 1


jamo

View 2 Replies View Related

Show Only Certain Related Records In Combo Box

Oct 14, 2006

I have a feeling this is a common and probably easy question, but I couldn't find anything on it in the forums.

I have a main customer form with multiple subforms on it to keep track of my clients insurance policies and claims. I enter their contact data in the main form, and the policy data on one of the subforms. Then when they have a claim, I enter the policy information on the claim subform as well.

How could I have the combo boxes in the claims subform (which is storing data in a claims table) only show the policy numbers (stored in a policies table) assigned to that particular person? I would assume I need to somehow filter the policies query so it only shows records for that particular person, but I'm not sure how to do that on the fly.

View 6 Replies View Related

Show All Records That Have More Than One Matching In A Related Table

Dec 16, 2005

Hi,
I've been trying to get this for ages now - both in the design view and in sql:

I have 2 tables - one called DrawingsRegister and a related one called DrawingRevisions. Each drawing has one or more drawing revisions. I want a query that will show each drawing (just once) that has more than one revision:


SELECT tblDrawingsRegister.DrawingNum, tblDrawingsRegister.DrawingName, tblDrawingRevisions.DrawingNum

FROM tblDrawingsRegister INNER JOIN tblDrawingRevisions ON tblDrawingsRegister.DrawingNum = tblDrawingRevisions.DrawingNum

WHERE ((Count([tblDrawingRevisions]![DrawingNum])>"0"));

Thanks for your time,
RCurtin.

View 1 Replies View Related

Remove Link To Related Records In Form

Jan 23, 2006

I have a Datasheet view of a form and it displays a "+" symbol. When expanded it returns a list of related records. How do I get rid of the "+" in my form?

View 8 Replies View Related

Duplicating Parent And Related Child Records

Dec 18, 2006

I am creating a purchase request form for my company. The main form contains the PO Request # (autonumber) and general vendor and shipping information. The subform contains the item numbers on the order, the quantity and costs. What I am trying to do is make it so that users can click a "duplicate" button on the main form of an existing PO Request and have all the data replicated into a new PO Request. A lot of what we order is repetitious and it would time saving if users could just duplicate an order and modify as necessary. Can anyone help me with this one...
Thanks!:confused:

View 2 Replies View Related

Sum Values From Multiple Related Records On A Form

Jan 26, 2013

I am fairly new to Access and have no formal training on this program, just a lot of trial and error. I have a database with 4 tables. They are tblEmployees, tblCourses, tblDates, and tblTraining. The key for each was an autonumber that is EMPLOYEEID, COURSEID, DATEID, and TRAININGID.

tblEmployee lists pertinent information regarding an employee (name, serial #, shift, etc). tblCourse lists all courses that are available for an employee (course name, #hours, required attendees, type of training, etc).

tblDates lists all available class dates and times for the courses in tblCourses and has a lookup field for COURSEID and COURSETITLE from tblCourses.

tblTraining lists all the training scheduled for and completed by an employee and has a lookup/relationship with tblEmployees for EMPLOYEEID and EMPLOYEENAME.

It also has a lookup/relationship field with tblCourses for COURSEID and COURSETITLE. Finally, it has a lookup/relationship with tblDates with lookup field/relationship with DATEID and CLASSDATE. I have successfully created a form where the training can be added to an employee (frmTrainingUpdated) and it has a subform (frmTraining) with all classes for that employee in a multilist at the bottom (from a query of tblTraining). The subform also has a field for whether the training was completed and then the hours are credited to the employee (txtCredit).

The problem comes when I try to add all of the credited hours for a single employee in a separate field. I am trying to create a field somewhere on the form that will total all of the hours for all of the completed classes for the one employee on the form. I have tried to list the data for the textbox as =DSUM([txtCredit], tblTraining, WHERE (EMPLOYEE=Me.Employee)) and only get an error message displayed in the textbox. I tried to do a totals SUM on the query and it only gives me the individual hours for each class on the same line for that record.

View 9 Replies View Related

Update Related Records And Remove Duplicates

Mar 18, 2014

I have two tables, one is of departments, and one is of people (with a FK denoting what department this person is in). Now consider the fact that there are duplicates in the departments table, and I would like to remove these duplicates. However, the duplicates have related records (in the people table). So, before removing the duplicates, I must update the FKs in the table of people (this is the step I'm having trouble with).

Here's an example:

As you can see, the "Sales" department is there twice. And both have a related record. What I want to do is:
Update all DepartmentIDs (in tblPeople) to not point to duplicate records. In this example, that would be PersonID 2; Joe. His DepartmentID should update to "1" (as both "1" and "2" are "Sales").Delete the duplicates in tblDepartments (in this case, DepartmentID 2, "Sales").

The second step is no problem, it is only the first I am struggling with.

Also, the example posted here is just an example, the data I actually need to do this for is significantly more complex and there are many more records! In the attached database:

qry1: Simple query to find all duplicates (just used the query wizard)
qry2: Just the first row of each duplicated departments (duplicates that shouldn't be deleted). In the example above, this would be the "2", "Sales" row in the tblDepartments table.
qry3: Basically all qry1 rows that don't appear in qry2
qry4: All qry3 values, and their respective qry2 value.

This is what each of the (soon to be deleted) duplicate values' related records' DepartmentID should be updated to... There's no simpler way to phrase that, so using the example above, qry4 would return "2","1". This indicates that all people with a DepartmentID of "2" should be changed to "1" (so we can subsequently erase the department with the ID of 2.

This is as far as I have gotten. My next step is: Update all FKs in tblPeople based on qry4 (You can't set an update query's criteria to pull from another query, nor can you use the second query for the update value... or maybe you can, but I don't know about it).

View 3 Replies View Related

Queries :: Query That Will Return Records From A Table That Have Related Records In Another Table

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

Help Required Selecting Specific Records From Related Tables

Apr 15, 2008

Hi,

Hope someone can help me out on this one. Searched the forum but can’t find anything to help me out.

I have two tables:
tblCustomers that contains unique customer records (names addresses etc.)
and
tblComments that contains comment data for the customers

Tables are joined one to many tblCustomers -> tblComments on account_ref

tblComments can contain several records per customer, all are datestamped.

I want just the latest datestamped comment record per customer, just can’t seem to work the logic on this one. Must be so simple but can’t fathom it.:confused:

Ideally, I’m producing a report of Customer data (Name, address, contacts etc) + the last comment record for each customer. Have started with a simple query, but have hit an impasse. Have tried sorting, group by, top 1, distinct etc, but don’t seem to be getting anywhere.:mad:

If someone can point me in the right direction, and give me a starter for 10 I’d be much appreciated.

View 1 Replies View Related

Forms :: Table With Choices For Subform / Related Records?

Jul 11, 2013

I have a table that has the list of "Project design" choices, and I enter in there the choices that a project can be. I then have that table related to a junction table that has the "Project design choices" linked to the "project code." Anyway, I THOUGHT that one of the bonuses to using Access was that if you see something spelled wrong, you could fix it in one table and it would fix it everywhere. However, when I see that I spelled something wrong in "TBLProjectDesignChoices" and I want to fix it, it tells me that I can't because it contains related records.... ok so, if this is bad design.. I may have to leave it because I have spent countless hours doing data entry for this..

View 8 Replies View Related

General :: Records Being Deleted In A Related Table When Not Supposed To

Jun 13, 2014

I am losing records in one table when I delete from another, i.e., I do want to delete records in one, but the related records in the other are also being deleted. This was not happening until I did a recent up date.I created a database in Access 2002 about 8 years ago and my client has been using it successfully ever since. I have occasionally made updates and enhancements. They have over the years upgraded and are now on Office 2010. I'm still using Access 2002.

I recently (3 weeks ago) added a new feature and installed the new code. The database is split, code and data. The new feature was working well, but suddenly they were losing records and they cannot operate until I have it resolved. I spent 2 hours today in their office and could not work out why it was happening.

I have a straight forward client table with names and addresses and some other information. I have another table which links together Clients, Counsellors and Supervisors and works out a room allocation for Therapy sessions. Once the Therapy sessions have been completed, we need to delete the Client, Counsellor, Supervisor + room allocation, but we do not want to delete the Client record in the Client table. The User is offered the opportunity to either archive the client record or not archive it, that's all. The Archive procedure is simply to put a tick in the "Archive" field, not delete the record.

However, when the Client, Counsellor, Supervisor + room allocation is deleted, it is also removing the Client record. I do have a relationship between Clients, Counsellor, Supervisor, but it doesn't have "enforce referential integrity", it is just a one-to-one relationship. The odd thing is that when I delete the allocation here at home on my Access 2002 system, it does not delete the Client Record, but it does in their office, using exactly the same code and data.

The Allocation is on a sub form and the way they delete is by highlighting the Allocation and then clicking on the X - Delete button on the Access menu (the program is not very sophisticated, but has worked until now). I have some code in the "on delete" event, but even if I take out all the code and just allow the deletion with the usual Access message "you are about to delete 1 record... " I have seen that the related Client record gets deleted at the same time. it does not happen on my system, only in their office.

View 14 Replies View Related

Queries :: Concatenate Related Records Into One Expression / Field In A Form

Feb 13, 2014

In my query, I have several results that relate to the same PK overall, and I'd like to concatenate these records into one expression/one field in a form.

Currently my query looks like this;

As you can see, the BandPK/BandFK are repeated where the GenreFK/GenrePK are different. What I'd like to do is concatenate the column named Genres into one field so the BandFK/PK isn't repeated.

View 14 Replies View Related

Tables :: Increment Number For Related Records Restarting At 0 For Each Parent

Sep 18, 2012

I have two tables, Articles and Versions, related 1 to many. In my Versions table I want to set up a field that will start at 0 for the first version record related to an article record, and as version records are added in relation to that same article record I want it to increment by 1, no gaps. It ideally would be editable. It will not likely count above 5.

The result would be

Code:
article1 version0
article1 version1
article1 version2
article2 version0
article2 version1
article2 version2
article2 version3

What's the best way to accomplish this?

View 3 Replies View Related

Modules & VBA :: Update Record Based On Related Records Completed

Dec 4, 2014

I have 2 tables, one is like a main table, containing all of the main data, such as a Job Number, Customer, Quantity, etc. I have a second, related, table that acts a breakdown of information. There may be several related records to one main record, it entirely depends on the nature of the job.

What I'd like to do is run a function that looks at a main record, checks if all the related records COMPLETED field is ticked and then tick a field in the main record. I only want it to do this for records where all of the related records are COMPLETED.

View 3 Replies View Related

Tables :: Record Cannot Be Deleted Or Changed Because Table Include Related Records

Oct 16, 2012

Three tables:

Employee, Sessions, EmployeeSessions.

Many sessions can have many employees - thus the joining table has been included.

When trying to delete an employee from the database using a form, I encounter the error:

The record cannot be deleted or changed because table 'tblEmployeeSessions' includes related records

Is there a problem with my table relationship structure? Or is it 'correct' that as the employee is supervising a session he/she cannot be deleted as this would interfere and maybe mess up the session record?

View 2 Replies View Related

Forms :: Search Query With Subform - Edit Records In Related Table

Nov 8, 2014

I have a query which looks for like * surname*

in tblemployee fname lname dept active

this works fine and i can search using a requery button

however as deptartments are stored in tbldepts

when i change the query to retrieve the dept name instead of number directly from the table and i try to change this on the datasheet subform it changes it in tbldepts instead?

how can i change what dept the employee is in (as in change the number in tblemployee - but display the actual name?)

View 1 Replies View Related

Auto Creating Record In One Table For Groups Of Related Records? + Stock Levels

Mar 23, 2008

Hey guys,

OK, your gonna have to bare with me a little bit as its hard to explain and if any VB is given please add a few annotations as I have to explain everything i do in a report (doest have to be too detailed, just to make the code understandable :) ) and if it needs better clarification feel free to ask :), but basically, I have the following relationship set up:

http://img512.imageshack.us/img512/3246/relationnshipswd9.jpg

At the moment, because of the way it is set up, I cannot create a record in the transactions table unless an income record is given for it (because tb_income (one) to tbl_transactions (many)) but the way I want to work is as follows:

If you have a look at the tables tbl_transactions and tbl_income and their link. The way I want the system to work is when a new transaction is made, a new income record in the "tbl_income" table would be made with the date (in tbl_income) being the date at that particular time and all transactions created on the same date would all go in the subdatasheet for that one record created for that date; and if another transaction is made on an alternate date (say 00:00am of the next day) another income record would be created automatically with the date being of that particular day etc.


My other problem im facing is that everytime there is a transaction created, I want the stock level(s) field of products in that particular transaction to be decreased by the quantity purchased of that product but i have no idea how to do so

Any help?

Thanks a lot in advance!

Daniel

View 4 Replies View Related

Append Queries To Related ID And Its Related IDs?

Aug 30, 2006

I have a list of class sessions. To help with maintaining attendance, each session has its own roster. I just need to add a functionality so user can make sure the attendance roster is synchronized with the past sessions and future sessions in events of last minute additions/drop or updating names/contact infos. The sessions are related to themselves as below:

ClassID PreviousClassID
1 Null
2 1
3 2
4 Null
5 4

So therefore to propagate the changes into all sessions how would I instruct the query to look for each related ID then checks if it's also related...

I'm thinking I may have to use VBA to do what, but I hope that can be done with a append query.

Thanks!

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved