473,491 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

One-to-Many relationships

I have a new database that has a main table (Contacts) with Contact ID as the
primary key/autonumber.

I also have another table (Resource) and have it linked to the main in a one-
to-many relationship, it also has a Contact ID as an autonumber, but it isn't
set as a primary key.

I have put (Resource) as a sub-form in my main table form, where the wizard
asks which fields are linked, and I put in the contact ID for each table.

What I am doing is, in the main table capturing contact information from
suppliers, and in the Resource table I capture information each time there is
an update with that contact. So I need to add many resource records to one
record in Contacts.

The problem is when I add a record to the main form, I can add a resource to
the sub form, but it will only let me add one record, as soon as I try and
add another it comes up with an error saying there needs to be a matching
record in the main form.

I have also noticed that the autonumber in the sub form does not match the
auto number in the main form. I have deleted all the records and compiled
database to start again, but it still has the same problem.

I have two other databases with this kind of set up and dont have any
problems at all, so I am not sure what I am doing wrong, have spent all
morning looking through to compare each database to see what differences I
can see and they all look the same.

Can any help please, I'm sure its something really simple

Thanks
Tracy

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200707/1

Jul 25 '07 #1
6 2079
"TracyM via AccessMonster.com" <u31966@uwewrote in message
news:75b2537d66794@uwe...
>
The problem is when I add a record to the main form, I can add a resource
to
the sub form, but it will only let me add one record, as soon as I try and
add another it comes up with an error saying there needs to be a matching
record in the main form.

I have also noticed that the autonumber in the sub form does not match the
auto number in the main form. I have deleted all the records and compiled
database to start again, but it still has the same problem.
It sounds like you haven't set up the parent/child link between the main and
sub. Select the subform object on the main form and check on the "data"
property tab.

HTH - Keith.
www.keithwilby.com

Jul 25 '07 #2
Hi Keith

Thanks for your reply, I have checked and I have the following set up:

Master field = Contact ID
Child Field = Contact ID
(Result= Show tblResource for each record in tblContacts using Contact ID)

Is the problem that I am only working with a couple of records at the moment
to test the database before importing the actual data.

But its still a problem with the numbering not matching as it does in my
other databases with the same set up?

Regards

Keith Wilby wrote:
>The problem is when I add a record to the main form, I can add a resource
to
[quoted text clipped - 5 lines]
>auto number in the main form. I have deleted all the records and compiled
database to start again, but it still has the same problem.

It sounds like you haven't set up the parent/child link between the main and
sub. Select the subform object on the main form and check on the "data"
property tab.

HTH - Keith.
www.keithwilby.com
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200707/1

Jul 25 '07 #3

"TracyM via AccessMonster.com" <u31966@uwewrote in message
news:75b2537d66794@uwe...
I have a new database that has a main table (Contacts) with Contact ID as
the
primary key/autonumber.

I also have another table (Resource) and have it linked to the main in a
one-
to-many relationship, it also has a Contact ID as an autonumber, but it
isn't
set as a primary key.
The Contact ID in your Resorce table should be a Long Integer not
autonumber. When linked, it's value will be filled-in from the Contact table
though the sub form when you add a new record.
>
I have put (Resource) as a sub-form in my main table form, where the
wizard
asks which fields are linked, and I put in the contact ID for each table.

What I am doing is, in the main table capturing contact information from
suppliers, and in the Resource table I capture information each time there
is
an update with that contact. So I need to add many resource records to one
record in Contacts.

The problem is when I add a record to the main form, I can add a resource
to
the sub form, but it will only let me add one record, as soon as I try and
add another it comes up with an error saying there needs to be a matching
record in the main form.

I have also noticed that the autonumber in the sub form does not match the
auto number in the main form. I have deleted all the records and compiled
database to start again, but it still has the same problem.

I have two other databases with this kind of set up and dont have any
problems at all, so I am not sure what I am doing wrong, have spent all
morning looking through to compare each database to see what differences I
can see and they all look the same.

Can any help please, I'm sure its something really simple

Thanks
Tracy

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200707/1

Jul 25 '07 #4
On Wed, 25 Jul 2007 11:00:28 GMT, "TracyM via AccessMonster.com"
<u31966@uwewrote:

That's wrong. Resource.ContactID should be a Number type, Long Integer
length, not an Autonumber.
Just think about it: you want a resource record to be associated with
a Contact of your choosing, not with some meaningless sequential
number.

-Tom.

>I have a new database that has a main table (Contacts) with Contact ID as the
primary key/autonumber.

I also have another table (Resource) and have it linked to the main in a one-
to-many relationship, it also has a Contact ID as an autonumber, but it isn't
set as a primary key.
<clip>

Jul 25 '07 #5
Hi

Thanks, that worked a treat, the only reason I didn't do that is because in
my other databases I have them on autonumber and don't have a problem with it
for some reason.

Anyway, thats a great help Thanks again

Tracy

paii, Ron wrote:
>I have a new database that has a main table (Contacts) with Contact ID as the
primary key/autonumber.

I also have another table (Resource) and have it linked to the main in a one-
to-many relationship, it also has a Contact ID as an autonumber, but it isn't
set as a primary key.

The Contact ID in your Resorce table should be a Long Integer not
autonumber. When linked, it's value will be filled-in from the Contact table
though the sub form when you add a new record.
>I have put (Resource) as a sub-form in my main table form, where the wizard
asks which fields are linked, and I put in the contact ID for each table.
[quoted text clipped - 22 lines]
>Thanks
Tracy
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200707/1

Jul 25 '07 #6
On Wed, 25 Jul 2007 14:07:38 GMT, "TracyM via AccessMonster.com"
<u31966@uwewrote:

That cannot be true. An Autonumber foreign key is always wrong.
-Tom.

>Hi

Thanks, that worked a treat, the only reason I didn't do that is because in
my other databases I have them on autonumber and don't have a problem with it
for some reason.

Anyway, thats a great help Thanks again

Tracy

paii, Ron wrote:
>>I have a new database that has a main table (Contacts) with Contact ID as the
primary key/autonumber.

I also have another table (Resource) and have it linked to the main in a one-
to-many relationship, it also has a Contact ID as an autonumber, but it isn't
set as a primary key.

The Contact ID in your Resorce table should be a Long Integer not
autonumber. When linked, it's value will be filled-in from the Contact table
though the sub form when you add a new record.
>>I have put (Resource) as a sub-form in my main table form, where the wizard
asks which fields are linked, and I put in the contact ID for each table.
[quoted text clipped - 22 lines]
>>Thanks
Tracy
Jul 25 '07 #7

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

Similar topics

0
1779
by: George | last post by:
I wrote a function that basically executes a dynamic query and returns True if there is at least one record and false in not. CREATE OR REPLACE FUNCTION RecordHasChild (table1, CHARACTER,...
0
1284
by: Jass | last post by:
Hi everybody! I guess the subject really states my question. I have a relatively simple query where I'm using an order by clause. The tables participating in the query have no more than ~300...
1
1686
by: rashika | last post by:
Hi : Can i call 2 procs within one task? I have sp_proc1 ? (and have declared one global variable as input parameter) now i have another sp_proc2 which uses same input parameter but if i...
7
319
by: tony | last post by:
Hi Any one know that can VS.net 2005 with vs.net 2003 worked together in one manchine? if it can working together, how can I set up it? Thanks Tony
25
2201
by: Method Man | last post by:
Q: Write a C/C++ program that takes an unsigned integer and adds 1 to it without using the plus or minus signs. Don't worry about overflow issues. It is cheating to use assembly commands, or to...
3
1879
by: Larry R Harrison Jr | last post by:
I designed this webpage: http://www.dbases.net/photography_pages/new_style_frames_index.html It has horizontal hover/pop-down menus; it works fine on the given machine run off the hard drive,...
18
16697
by: Ptp | last post by:
is there a integer data type of one byte in gcc? I know delphi have fundamental integer types include byte, shortint... the byte types is unsigned 8-bit, such as below: procedure...
7
6217
by: mp | last post by:
No value given for one or more required parameters. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information...
2
1157
by: Edward | last post by:
I've one datagrid and one frame with id ="frmdetail", in the datagrid, there is one template column which includes one HyperLink, <asp:HyperLink id="detaillnk" runat="server" text='detail'...
7
4649
by: somnamblst | last post by:
I am using jQuery & hideAllExcept.js from this demo tute http://enure.net/dev/hide-all-except-one/ The issue is that on a page with other content, the images I have placed in the toggleThis...
0
7115
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,...
0
7154
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,...
0
5451
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,...
0
4578
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...
0
3086
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...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
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 ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.