"You cannot add or change a record because a related record is required", but related record exists?

Both tables include a text field named LanID. You are using that field in this relationship, which enforces referential integrity:

Relationships Diagram

The problem you're facing is due to the Lookup field properties. This is the Row Source:


But the value which gets stored (the Bound Column property) is the first column from that SELECT statement, which is the Long Integer [LanID].ID. So that number will not satisfy the relationship, which requires results.LanID = [LanID].LanID.

You must change the relationship or change the Lookup properties so both reference the same field value.

But if it were me, I would just eliminate the Lookup on the grounds that simple operations (such as this) become unnecessarily confusing when Lookup fields are involved. Make results.LanID a plain numeric or text field. If you want some kind of user-friendly drop-down for data entry, build a form with a combo or list box.

For additional arguments against Lookup fields, see The Evils of Lookup Fields in Tables.

Related to : "You cannot add or change a record because a related record is required", but related record exists?
error: You cannot add or change a record because a related record is required in table
You apparently have a database Relationship defined between the [LoginLogTable] and [Privileges] tables that is attempting to enforce Referential Integrity. The unknown Manager has no matching row in [Privileges], so when you try to add his (non-existent) UserName into [LoginLogTable] the database won't let you. If you want to log access attempts from unknown Managers then you should disable "Enf
┬┐How to avoid record from a table in pagination if this record is not present in another related table? CAKEPHP
what you'll want to use is a Counter Cache. Go to http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html and search for 'counterCache,' and you'll find instructions. Basically, you want to implement a "counter cache" field in model 1, that automatically keeps count of the number of linked records in model 3. Then, to exclude records from Model 1 that have no related recor
the related record does not change after update execution with no error using EF
This line of code: var updatingRow = Find(valueField); is not using your current context meaning that db doesn't see anything to change. Change it to: var updatingRow = db.Find(valueField);
How to check for record by using ID, then if record exists update if not add new record
Using VBA, here is a sample of how to query for a certain ID to check if it exists. If it does not then add it via an INSERT statement: Dim rs As DAO.Recordset Dim StrSql As String StrSql = "SELECT * FROM MyTable WHERE ID = " & txtMyID Set rs = CurrentDb.OpenRecordset(StrSql, dbOpenDynaset) If (rs.RecordCount = 0) Then DoCmd.RunSQL "INSERT INTO MyTable (ID, Field1, Field2) VALUES " &
Retrieve all records from one table even if a related record can't be found in a related table
I think you need to rewrite that one using joins, then you will be able to use LEFT JOIN. It works the way you need. The thing I can do in some minutes looks like that: SELECT ws.wastetype, SUM(ws.recordedweight) totalWeight, SUM(ws.percent) totalPercent, wt.id, wt.category, wt.defrecycling, fw.tonnes FROM wastetypes wt LEFT JOIN wastestream ws ON (wt.id = ws.wastetype) INNER JOIN f

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .