General :: Unwanted Deletion Related To Particular Record In Conversation Table

Mar 6, 2013

I have 2 tables.
1- customers table with 2 fields : customername,customerno
2-conversationstable with 4 fields: date,customername,customerno,details

The conversations table is for keeping memo of telephone conversations with the customers.

I built a simple form deriving from the conversations table. And added to it a combobox with 2 columns from customers table to select the customername an customerno for the form.

While deleting the record in the conversations table,through the form, I saw that the customername and customerno in the customers table of that particular customer record are deleted also. I made no links between both tables.

I wonder why that happened.

View Replies


ADVERTISEMENT

Table With Key In Two Fields - Record Deletion

Oct 21, 2015

I have a table whose key is two fields. I am having no luck in selecting a given record from a form and deleting it. No problem in a table with a single field key.

View 14 Replies View Related

General :: Update Record ID To Another Record ID In Same Table And Update Related Records

Aug 22, 2013

I have a table called tblCompanies. When a company acquires another company, I need a method by which the acquired company's CompanyID (PK) can be updated to the new company's CompanyID (PK). I also need to be able to update all related CompanyIDs (FKs) to the new value in related tables.

In cases in which the new company does not have an existing record, there is no problem: the company name simply gets changed to the new company and the existing CompanyID is maintained. I then use an audit table and Track Changes function to keep track of the company name data and a union query to keep the old names in the selection lists.

The problem is when both companies already have existing records in the table.

So, let's say I have records for Company A and Company B. Company A merges with Company B and Company B is now the main record. What is the best, simplest and easiest way to update the CompanyID (PK) from A to B and change the CompanyID (FK) to the new value in all related tables?

I am envisioning a pop-up form that directs the user to select the new company and then an update query happens behind the scenes... but exactly how does the criteria for the update query get selected and how do all the related tables get updated? My vba skills are pretty basic, will I need extensive coding to do something like this?

View 6 Replies View Related

"You Cannot Add Or Change A Record Because A Related Record Is Required In Table....

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

Tables :: Cannot Add Or Change A Record Because A Related Record Is Required In Table

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

Forms :: Cannot Add Or Change A Record Because A Related Record Is In Table

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

Cannot Add Or Change A Record Because Related Record Is Required In Table

Aug 12, 2013

I have a problem with my access form, it said "You cannot add or change a record because a related record is required in table". I have attached the access file.

View 14 Replies View Related

General :: Access 2007 / Finding A Related Record That Has 2 Foreign Keys?

Jan 22, 2013

I am using access 2007

i have a materialsUsed tbl that list all the materials used in a job and the quantity of each.

(ID
Material Code
Quantity
Unit of Measure)

I also have 2 look-up tables - 1 for the material codes and 1 for the units of measure

I have another table, priceperunitofMeasure

id
material Code (FK to material lookup tbl)
Unit of Measure (FK to unit of measure tbl)
Price

In my form Users will select material code from combo box - enter the quantity, and select a unit of measure from a combo box.

For example: they could enter the following :

Paint 2 gallons
Paint 3 tubes
Paint 1 pint

How do I lookup the price per unit of measure for each of these records in the price per unit of meassure table? The price per unit of measure table has 2 foreign keys.

View 4 Replies View Related

Cannot Add Record To A Table Because Related Record Is Not Recognized

Feb 13, 2008

Hi everyone,
I am using Access 2007 and I have a database with 2 tables. The original table has a primary key field designated. I have a relationship between that table and a second table and that relationship has "enforce referential integrity" checked.

In the secondary table the field that the relationship is bound to is not a primary key but has the same field properties.

I created a new record in the original table and created the primary key of "T-124". When I attempted to add the same data to the field in the second table, I recieved the following error message: "You cannot add or change a record because a related record is required" in the other table.

I did create the record in the other table:eek:

Can anybody help????:(

View 4 Replies View Related

General :: Web App Displaying Fields From Another Table In Related Items

Jul 30, 2015

I have two tables to track our engineer visits, one tracks the visit as a whole and the other tracks the individual instruments the engineer worked on during that visit. This way I can track visits to customer sites separately to the visits made to an individual instrument.

Right now, I create a visit and then add Visit Lines (containing the details of the instrument visited). These instruments, or 'Visit Lines', are being displayed in the Visits Table via a related items box. Visit lines are associated with Instruments in the Instrument Table via a serial number lookup. All this works great...

However, I want to display both the serial number and the instrument description in the related items control in the Visits Table. Since the Visit Lines table only has the instrument ID lookup and not the instrument description I can't display it in the control.

I need to either:

a) Create an instrument description in the Visit Lines table as a lookup and have this automatically pull in the description based on the serial number the user selects.... which I can't figure out how to do - it's just an autocomplete.

b) Create an instrument description in Visit Lines and have a macro grab the corresponding description from the Instruments table based on the serial number input - but just for this record...

View 2 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

Modules & VBA :: Control Tip To Show Related Record From Another Table

May 18, 2015

Is it possible to have the control tip show related records from another table?

I've been looking around the internet, and I've seen many examples for showing concatenated fields on current record, but had no luck with what I'm trying to do.

For example.

I have a continuous form, and on it shows top line data. Where a record in this form shows as "Split" it means I have more data related to this record on another table.

Is it possible to show however many fields are related to this record, when I control tip, or mouseover?

I've been playing with

Code:
Me.textbox.ControlTipText = Me.textbox

but was wondering, if this is possible, how I'd reference the other table,

If said column of continuous form is "split"...
lookup related table by ID number
show however many columns of data..

View 2 Replies View Related

Forms :: Form Data To New Record Related Table

Aug 19, 2013

I have a form based on a table which includes the mid field. I want to have a macro that takes the value of the current mid, and makes a new record in a 1-many related table (consisting of record id (auto), mid and trmntdate), paste the mid and insert the current date.For the life of me I cannot get it to work? The process should be something like:copy mid value, add new record to related table, paste value in mid, insert current date in trmntdate, save. I've tried append queries, experimented with copy etc, dabbled blindly with VBA and not got anywhere.

View 14 Replies View Related

Modules & VBA :: Adding New Record To Related Table In SubForm

May 13, 2015

I am currently working on an Access Database that houses our security clearance information. Most of the system is up and running but the most recent form has got me spinning my wheels. I have a Word User Form that users will download and complete, once completed the macros will automatically send us the document to be added to our database. Most of this is working the problem is that this portion of the database has multiple related tables and at any given time a user may require multiple records in the related tables. I have created the code to copy most of the information but am getting stuck adding a new record on the sub-form when multiple items are required. Here is a breakdown of the scenario

Word Doc Table 1 = Basic Organization Info
Word Doc Table 2+ = Sites to Visit (There could be more than 1 table added here)
Word Doc Table 3+ = People to go on site (this might not be the third table based on user interaction for sites)

So far I can get Table 1 and Table 2 data but if there are more than 1 site I cant seem to get the system to create a new record on the related table it is creating a new record on the main form. Here are the lines I used to try to create the related record..

Me.RFV___Agencies1.SetFocus
DoCmd.GoToRecord , , acNewRec

When I put just the above code on a button it seems to have worked as the sub-form showed an additional record was created but when using this on my macro the sub-form is not taking the focus for some reason.

View 1 Replies View Related

General :: Update Name Fields From Related Table Along With Auto-number?

Jul 1, 2014

The "PersonalDetails" table is related to the "Application" table using the autonumber from table, "PersonalDetails".

The "PersonalDetails" table has "StudentID" (autonumber), "First Name" and "Last Name" fields.

The "Application" table also has "StudentID", "First Name" and "Last Name" fields.

The "Application" table is related to the "PersonalDetails" table using the "StudentID" field.

How do I make it so that the first and last names on the "Application" table are automatically updated when the StudentID is entered?

View 2 Replies View Related

Record Deletion In My Forms

Apr 14, 2006

I have a form with a sub-form and a sub-sub-form :p
If I try to delete the record being viewed in the sub-form using
With DoCmd
.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End With

Then I here a ding (like you do when you try to delete a record) but I see no record delete confirmation box come up, if I hit enter, it deletes. So its there, but I can't see it, it's not behind the form either.
Any ideas?
Cheers

View 2 Replies View Related

Record In Subform Won't Allow Deletion

Jul 20, 2005

hiya

i have a subform which won't allow me to delete a record unless i'm in the datasheet view. is there anyway to change this. the properties have been set to allow deletions.

thanks
trish

View 7 Replies View Related

Opening Forms And Unwanted Record Advancing..help..please!

Apr 3, 2007

Hi all,

Ok, this is a seemingly VERY simple problem gone haywire!

I have a very simple database that gathers data from 50 questions. It stores these in fields as numbers (1 - 10). no problem.

However, I've had to split the questions over 3 forms and this is where the problem begins. When I reach the end of the first lot and I click the button to open the next form, it jumps to the next record. So, on Form 1 we were on record 5 and then form 2 continues as record 6 (form 3 would be record 7).

All I want is for them all to appear in the same record.

Any hints as to what im' obviously doing wrong?

Many thanks!

View 12 Replies View Related

Forms :: Unwanted Extra Record In Subform

May 20, 2013

I have a continuous subform with allow additions set to false. To make a new record I have used some update vba to create the record direct in the underlying query, then requery the form and the partly created record appears. The user then adds a quantity and some text. The subform still appears without the new record line.....However if I click the button again to create a second new record I end up getting an extra 2 lines.

One is a duplicate of my previous one and a new blank record. These do not actually appear in the underlying table and the subform looks ok. However this extra record confuses the end user and I want to avoid it. Refresh or shift f9 does not eleviate the problem. Sometimes I even get two "current record" pointers.

View 3 Replies View Related

Incrementing Counter And Record Deletion

Apr 1, 2007

Hi,

The user wants all of the records in the database to have continuous numbering. I have used AutoNumber in the past but if you delete a record, it produces gaps in the numbering.

I was wondering if there is a way to number the records so they are always numbered continuously (1,2,3,etc.) even if some record is deleted.

I have tried using the following:


Set db = CurrentDb()
Set recordlist = db.Openrecordset("SELECT Max(tblContactHistory.ItemID) AS MaxID FROM tblContactHistory")

ItemID = (recordlist!MaxID + 1)

recordlist.Close
Set recordlist = Nothing


but I still cannot get the records to have continuous numbering after a record is deleted.


Any helped would be appreciated.

Thanks!

View 1 Replies View Related

Custom Record Deletion Sequence

Aug 7, 2007

I want to create a custom sequence when deleting a record but I'm having a problem.

What I want to do is prompt the user for the reason he/she is deleting the record and then archive this so it can be viewed in a log at a later time. This extra step is not as easy as I thought it would be.

What I did was put some coding into the On Delete event of the form. The code opens a form with a text box. The user can enter the reason for the delete in the text box and click OK or click cancel to abort the deletion.

My problem here is opening another form from the On Delete event. As soon as the form is open, the code just passes to the next step of the sequence and deletes the record.

There are 2 approaches that I've thought of but I'm not happy with either.

Approach 1:
In the On Delete event, set Cancel to True. That way the deletion is not handled by the delete sequence but rather by the new form that opens. The problem is that deleting a record from another form is not that simple. What I've tried is to execute a SQL statement that grabs the ID of the record from the open form and delete it. The problem is that although the record is deleted, all the fields on the form say #Deleted in them which is not that pretty. (Maybe there's some other way to do the deletion without this problem that I'm not aware of...?)

Approach 2:
Use an Inputbox. Unlike a custom form, the Inputbox delays execution of the code so the code can determine from the results (i.e. should it cancel the delete if the user clicked Cancel). The problem with Inputboxes is that they are not very flexible in the layout, they look pretty "packaged" (i.e. they look to me like the programmer didn't bother creating a means to enter a value). There's no way to place the buttons where you want or have it do better validation (e.g. I want the FORM to check that there's at least a few words describing why the user is deleting the invoice rather than have the form with the record get the input message passed back and then give an error and then pop open the Inputbox again)

I think that especially when you're creating an application with anything financial, you'll want to log a deleted invoice including the date, amount, possibly the client's name, invoice number, reason for deletion and the login name of the person doing the deletion. All of these are easy to record other than the reason.

Help would be much appreciated.

SHADOW

View 5 Replies View Related

Problem Inserting A Record After A Deletion

Apr 25, 2006

I have a form and a subform. There are a number of buttons on the form, allowing me to add, update, delete, etc. records from the subform. The process is that I select a record on the subform, its details are displayed on the form, then clicking on <Delete>, for example, removes it.

Each of these processes work fine on their own and also if carried out one after the other, for the most part. The one problem I'm finding is when I delete a record.

Firstly, the subform appears to refresh and the record is no longer shown. However, if I then try to select another row from the subform, I get a message saying 'record is deleted'. I click on <OK> to remove this message and I can then select the same row or another row without any problems.

Secondly, if I now try to add a new record (the code behind the button is just 'DoCmd.GoToRecord , , acNewRec'), I get a message saying that I can't go to the selected record.

If I close and reopen the form between each activity, all works fine, suggesting that something isn't refreshing properly. I've tried putting 'Me.refresh' and 'Me.requery' immediately after running the deletion, but to no effect.

Any suggestions?

View 5 Replies View Related

Modules & VBA :: Add Record Name To Deletion MsgBox

Aug 19, 2013

I'm using this stardard piece of code on a button that deletes a record from a simple continuous contact form.

Code:
If MsgBox("Do You Want To Delete This Record?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete?") = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
End If

If the form is called "CONTACTS" with a field called "Contact_Name", what code do I use to have the relevant Contact_Name appear in the MsgBox to be sure that I'm deleting the correct record ...... something like this .....

Do You Want To Delete The Record Called Paul Quinn ?

View 2 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

Tables :: Time-stamp Creating New Unwanted Blank Record

Jul 28, 2014

I am trying to do has to be done in a table and without the use of forms (becasue its what works for us) in Access 2007. I have a table where my staff records a number of different data fields for accounts. I currently have a 3 table relationship established. One of these table is our "Notes" table. My staff enters continuous notes for different accounts as new information come in.

What I have done is set my "date" field's default value to "now()" which accomplishes the time-stamp I need, but at the same time as soon as they type anything in another field in that row Access creates another row which is unwanted. follow up how can I go about also having a field that auto fills w/ the user's name/ID?

View 8 Replies View Related

Modules & VBA :: Reset Autonumber After Record Deletion

Jul 16, 2015

We need to reset the autonumber after the last record is deleted.

For example:
2006
2007
2008

if 2008 gets deleted, we want the autonumber to reset back to 2008 rather than move to 2009.

Is this possible? This is the code we are using but cannot get the string to recognize the variable. If the variable is replaced with a number, it works, but it defeats the purpose of adding the plus 1 to the last autonumber.

Code:
Private Sub Command0_Click()
Dim RLMax As Integer
Dim Statement As String
RLMax = DMax("[id]", "Table1")
RLMax = RLMax + 1

strSQL = "Alter table table1 Alter Column Id Autoincrement(RLMax,1)"
DoCmd.RunSQL strSQL
End Sub

I realize we don't want to depend on the autonumber for anything other than a row identifier, but the table is setup that it is important for the rows to be sequential if the last record is deleted. Only if the last record is deleted.

View 12 Replies View Related







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