473,796 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Relationship Link

I have 3 tables:

tbl_customer
-CustID
-fkeyMarketingID
-CompName
-CompAddr
-ContactName
-ContactAddr
-Ph
-Fax

tbl_Marketing
-MarketingID
-fkeyMarketItemI D
-MarketQty
-MarketDateSent

tbl_MarketDetai ls
-MarketItemName

The relationship looks like this:
tbl_MarketDetai ls (one) ------ (many) tbl_Marketing , (enforce
referential integrity - ticked ) , (join type - rows in both tables equal)

tbl_Marketing (one) ------ (many) tbl_customer , (enforce referential
integrity - ticked ) , (join type - rows in both tables equal)

Problem: I created a query with all the 3 table fields in this query where a
form (frm_newcustome r) is linked. It does not work in terms of allowing me
to save new entries in the form. I get the following message:
"You cannot add or change a record because a related record is required in
table 'tbl_Marketing' "
I don't understand - every field from the 3 tables is accounted for in the
query.
Nov 13 '05 #1
6 1900
This error can be triggered by the presence of a Default Value in the fields
of the lookup tables, or a Default Value in the controls that are bound to
the lookup tables.

Although you are not trying to add records to those tables, Access (wrongly)
applies the Default Value, and then complains that it can't add the record.
Removing the Default Value solves the issue.

There are other possible causes, but that one is less than obvious to track
down.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Gary T." <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
I have 3 tables:

tbl_customer
-CustID
-fkeyMarketingID
-CompName
-CompAddr
-ContactName
-ContactAddr
-Ph
-Fax

tbl_Marketing
-MarketingID
-fkeyMarketItemI D
-MarketQty
-MarketDateSent

tbl_MarketDetai ls
-MarketItemName

The relationship looks like this:
tbl_MarketDetai ls (one) ------ (many) tbl_Marketing , (enforce
referential integrity - ticked ) , (join type - rows in both tables equal)

tbl_Marketing (one) ------ (many) tbl_customer , (enforce referential
integrity - ticked ) , (join type - rows in both tables equal)

Problem: I created a query with all the 3 table fields in this query where
a
form (frm_newcustome r) is linked. It does not work in terms of allowing me
to save new entries in the form. I get the following message:
"You cannot add or change a record because a related record is required in
table 'tbl_Marketing' "
I don't understand - every field from the 3 tables is accounted for in the
query.

Nov 13 '05 #2
To add a record to tbl_Customer you need a record in tbl_Marketing that has
a value in the field joining the two tables that matches the value you are
entering in the joined field (on the tbl_Customer side of the join) for the
new record in tbl_Customer.

--
Wayne Morgan
MS Access MVP
"Gary T." <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
I have 3 tables:

tbl_customer
-CustID
-fkeyMarketingID
-CompName
-CompAddr
-ContactName
-ContactAddr
-Ph
-Fax

tbl_Marketing
-MarketingID
-fkeyMarketItemI D
-MarketQty
-MarketDateSent

tbl_MarketDetai ls
-MarketItemName

The relationship looks like this:
tbl_MarketDetai ls (one) ------ (many) tbl_Marketing , (enforce
referential integrity - ticked ) , (join type - rows in both tables equal)

tbl_Marketing (one) ------ (many) tbl_customer , (enforce referential
integrity - ticked ) , (join type - rows in both tables equal)

Problem: I created a query with all the 3 table fields in this query where
a
form (frm_newcustome r) is linked. It does not work in terms of allowing me
to save new entries in the form. I get the following message:
"You cannot add or change a record because a related record is required in
table 'tbl_Marketing' "
I don't understand - every field from the 3 tables is accounted for in the
query.

Nov 13 '05 #3
It's still not working.
Basically trying to use the frm_NewCustomer to enter info on new customers.
Customer A could have the following record of sent material (a subform of
tbl_marketing).
MarketItemName MarketQty MarketDateSent
BrochureA 9 9/9/05
SampleC 6 10/6/05
BrochureE 5 10/6/05

I have now simply placed all the marketing in one table:

tbl_Marketing
-MarketingID
-MarketItemName
-MarketQty
-MarketDateSent

Somehow this won't work as I think i still need to separate the
MarketItemname in its own table to
allow me to have a record of different materials sent at different dates per
customer.
I did this before as mentioned in my last post but no success.


"Wayne Morgan" <co************ *************** @hotmail.com> wrote in message
news:R8******** ******@newssvr1 2.news.prodigy. com...
To add a record to tbl_Customer you need a record in tbl_Marketing that has a value in the field joining the two tables that matches the value you are
entering in the joined field (on the tbl_Customer side of the join) for the new record in tbl_Customer.

--
Wayne Morgan
MS Access MVP
"Gary T." <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
I have 3 tables:

tbl_customer
-CustID
-fkeyMarketingID
-CompName
-CompAddr
-ContactName
-ContactAddr
-Ph
-Fax

tbl_Marketing
-MarketingID
-fkeyMarketItemI D
-MarketQty
-MarketDateSent

tbl_MarketDetai ls
-MarketItemName

The relationship looks like this:
tbl_MarketDetai ls (one) ------ (many) tbl_Marketing , (enforce
referential integrity - ticked ) , (join type - rows in both tables equal)
tbl_Marketing (one) ------ (many) tbl_customer , (enforce referential integrity - ticked ) , (join type - rows in both tables equal)

Problem: I created a query with all the 3 table fields in this query where a
form (frm_newcustome r) is linked. It does not work in terms of allowing me to save new entries in the form. I get the following message:
"You cannot add or change a record because a related record is required in table 'tbl_Marketing' "
I don't understand - every field from the 3 tables is accounted for in the query.


Nov 13 '05 #4
What are the names of each table, the fields in those tables, and which
fields the tables are linked on?

--
Wayne Morgan
MS Access MVP
"Gt394" <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
It's still not working.
Basically trying to use the frm_NewCustomer to enter info on new
customers.
Customer A could have the following record of sent material (a subform of
tbl_marketing).
MarketItemName MarketQty MarketDateSent
BrochureA 9 9/9/05
SampleC 6 10/6/05
BrochureE 5 10/6/05

I have now simply placed all the marketing in one table:

tbl_Marketing
-MarketingID
-MarketItemName
-MarketQty
-MarketDateSent

Somehow this won't work as I think i still need to separate the
MarketItemname in its own table to
allow me to have a record of different materials sent at different dates
per
customer.
I did this before as mentioned in my last post but no success.


"Wayne Morgan" <co************ *************** @hotmail.com> wrote in
message
news:R8******** ******@newssvr1 2.news.prodigy. com...
To add a record to tbl_Customer you need a record in tbl_Marketing that

has
a value in the field joining the two tables that matches the value you
are
entering in the joined field (on the tbl_Customer side of the join) for

the
new record in tbl_Customer.

--
Wayne Morgan
MS Access MVP
"Gary T." <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
>I have 3 tables:
>
> tbl_customer
> -CustID
> -fkeyMarketingID
> -CompName
> -CompAddr
> -ContactName
> -ContactAddr
> -Ph
> -Fax
>
> tbl_Marketing
> -MarketingID
> -fkeyMarketItemI D
> -MarketQty
> -MarketDateSent
>
> tbl_MarketDetai ls
> -MarketItemName
>
> The relationship looks like this:
> tbl_MarketDetai ls (one) ------ (many) tbl_Marketing , (enforce
> referential integrity - ticked ) , (join type - rows in both tables equal) >
> tbl_Marketing (one) ------ (many) tbl_customer , (enforce referential > integrity - ticked ) , (join type - rows in both tables equal)
>
> Problem: I created a query with all the 3 table fields in this query where > a
> form (frm_newcustome r) is linked. It does not work in terms of allowing me > to save new entries in the form. I get the following message:
> "You cannot add or change a record because a related record is required in > table 'tbl_Marketing' "
> I don't understand - every field from the 3 tables is accounted for in the > query.
>
>



Nov 13 '05 #5
See my first post in the thread discussions. All the tables/fields are
listed and the join relationships described.
"Wayne Morgan" <co************ *************** @hotmail.com> wrote in message
news:yU******** *********@newss vr14.news.prodi gy.com...
What are the names of each table, the fields in those tables, and which
fields the tables are linked on?

--
Wayne Morgan
MS Access MVP
"Gt394" <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
It's still not working.
Basically trying to use the frm_NewCustomer to enter info on new
customers.
Customer A could have the following record of sent material (a subform of tbl_marketing).
MarketItemName MarketQty MarketDateSent
BrochureA 9 9/9/05
SampleC 6 10/6/05
BrochureE 5 10/6/05

I have now simply placed all the marketing in one table:

tbl_Marketing
-MarketingID
-MarketItemName
-MarketQty
-MarketDateSent

Somehow this won't work as I think i still need to separate the
MarketItemname in its own table to
allow me to have a record of different materials sent at different dates
per
customer.
I did this before as mentioned in my last post but no success.


"Wayne Morgan" <co************ *************** @hotmail.com> wrote in
message
news:R8******** ******@newssvr1 2.news.prodigy. com...
To add a record to tbl_Customer you need a record in tbl_Marketing that

has
a value in the field joining the two tables that matches the value you
are
entering in the joined field (on the tbl_Customer side of the join) for

the
new record in tbl_Customer.

--
Wayne Morgan
MS Access MVP
"Gary T." <g4****@hotmail .com> wrote in message
news:43******** *************** @news.optusnet. com.au...
>I have 3 tables:
>
> tbl_customer
> -CustID
> -fkeyMarketingID
> -CompName
> -CompAddr
> -ContactName
> -ContactAddr
> -Ph
> -Fax
>
> tbl_Marketing
> -MarketingID
> -fkeyMarketItemI D
> -MarketQty
> -MarketDateSent
>
> tbl_MarketDetai ls
> -MarketItemName
>
> The relationship looks like this:
> tbl_MarketDetai ls (one) ------ (many) tbl_Marketing , (enforce
> referential integrity - ticked ) , (join type - rows in both tables

equal)
>
> tbl_Marketing (one) ------ (many) tbl_customer , (enforce

referential
> integrity - ticked ) , (join type - rows in both tables equal)
>
> Problem: I created a query with all the 3 table fields in this query

where
> a
> form (frm_newcustome r) is linked. It does not work in terms of
allowing me
> to save new entries in the form. I get the following message:
> "You cannot add or change a record because a related record is
required in
> table 'tbl_Marketing' "
> I don't understand - every field from the 3 tables is accounted for
in the
> query.
>
>



Nov 13 '05 #6
Ok, so this "subform" you are entering the new customer in is based on the
tbl_Customer table? Also, in your original message you list tbl_Marketing
with a fkeyMarketItemI D field, but you don't show a table where this is the
primary key field.

When entering a new customer, the value for fkeyMarketingID that is entered
(or not entered, i.e. Null) will have to exist in tbl_Marketing in the
MarketingID field.

Also, you say that this "subform" is "a subform of tbl_marketing". Are you
doing this with a form or a sub datasheet directly in the table? Have you
set the Parent/Child link fields for the form/subform setup?

The advantage of separating the MarketItemName into a separate table would
be to use a combo box on the form to "lookup" the name of the item instead
of having to type it in all of the time. You would then need a form to keep
this table up to date. Another option would be to base the Row Source of the
combo box on this field in the tbl_Marketing table and just add a new item
when needed. You would query the field so that duplicates would be hidden.
The combo box will then show you each item that already exists and you would
add new items when needed just by typing them in if you didn't find them in
the list.

Example Row Source:
SELECT DISTINCT MarketItemName FROM tbl_Marketing ORDER BY MarketItemName;

--
Wayne Morgan
MS Access MVP
"Gt394" <g4****@hotmail .com> wrote in message
news:43******** **************@ news.optusnet.c om.au...
See my first post in the thread discussions. All the tables/fields are
listed and the join relationships described.

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1680
by: Chris Strug | last post by:
Hi, Probably a very simple question but I'm afraid my experience at this is somewhat limited so... In a database with a many to one relationship, say orders to customers, is it preferable to have an UID for a customer and store this in the orders table rather than the customer name, for example. CUSTOMERS
28
2214
by: Jeff Lanfield | last post by:
Suppose I have users that can belong to organizations. Organizations are arranged in a tree. Each organization has only one parent organization but a user maybe a member of multiple organizations. The problem that I'm facing that both organizations and individual users may have relationships with other entities which are semantically the same. For instance, an individual user can purchase things and so can an organization. An individual...
6
1861
by: Phil M | last post by:
I have two tables: Persons and Households, in a many-to-one relationship (many persons in one household). Persons has householdID as FK. The problem is that I want my form to use Persons as the master. That is b/c the user interface is entirely person-oriented -- searching, creating new records, etc. is done person by person, not household by household. But when I try to set up the form with this reversed relationship, I get a "You tried to...
0
1058
by: David | last post by:
Hi, I have the following Tables: JS_Customer JS_Job JS_Product JS_Pack The layout:
4
6016
by: Melissa | last post by:
I have a frontend file named CustomerApp and backend file named CustomerData. CustomerApp is at C:\Customer Database and CustomerData is at S:\Customer Database. Could someone help me with the code to do the following: 1. Create a new table named TblCustomerContact in CustomerData 2. Add a field named CustomerContactID (autonumber) in TblCustomerContact 3. Add a field named CustomerID (Number-Long) in TblCustomerContact 4. Add a field...
2
1396
by: Phil | last post by:
I am learning Access, and have one question on relationships. How does one handle establishing a relationship that could be one-to-many, going either way between two tables? Example: One table lists home addresses. Another table lists kinds of correspondence (letters sent). There is a 3rd table with letter information (date, topic, etc.). There could be 100 addresses in one table and 10 kinds of letters in another table. There could...
3
7407
by: lorirobn | last post by:
Hello, I have a report which uses a subreport. When I run the report, I get "Enter Parameter Value" error message for "tblGuestRoom". I click ok and the report seems to work fine. I narrowed down this error to the Link Master Fields property setting, when I tried the same scenario with form/subform. It gave me error: 'The Link Master fields property setting has produced this error: The object doesn't contain the Automation object...
4
2865
by: Sasha | last post by:
Hi everyone, What is the best way to implement many-to-many relationship between objects? Any examples or links are welcome! Thank you, Sasha
7
2013
by: Ron | last post by:
Hi All, Using Access2000, winXP. Table 1 = tblClients displayed on frmClients via qryClients. 2nd table = tblInvoices shown on frmInvoices via qryInvoices. 2nd table = tblDetails shown on subform(to frmInvoices) sfrmDetails via qryDetails. Relationship built between tblClients/tblInvoices/tblDetails by ClientID. Relationship between tblInvoices/tblDetails by InvoiceID. All works fine if
5
5000
by: Yitzak | last post by:
Hi after adding a field to a table through VBA How do I create a foreign key constraint/relationship between this field and a field in another table - and enforce referential integrity through VBA code. Thanks
0
9679
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10453
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.