473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

One-to-Many Relationship: Suggestion Requested

I have a subform (sfrmDocs) that I would like to link to a main form (frmViewAllResources). I'm trying to make sfrmDocs a continous form that would allow the user to associate files. These are the underlying tables' fields:

tblResources
==========
AutoNumber [PK]
RecordDate
Quantity
FiscalYear
BulkObligation
Project
Resource
Type
GeneralDescription
Subobligated
Liquidated

tblDocs
======
AutoNumber [FK]
FilePath
Description

What would be the best way to relate two fields in order to create a one-to-many relationship? If I link AutoNumber to AutoNumber, I can only get one-to-one. This makes sense to me. I've also asked myself why I would need them to be separate tables to begin with. Basically, tblDocs needs its corresponding form (sfrmDocs) to be continuous (in case many different files are associated to the record) and I'm quite sure I couldn't make only part of a form continuous. Can someone please suggest a solution?

Thanks.
Dec 14 '07 #1
3 1284
Rabbit
12,516 Expert Mod 8TB
I have a subform (sfrmDocs) that I would like to link to a main form (frmViewAllResources). I'm trying to make sfrmDocs a continous form that would allow the user to associate files. These are the underlying tables' fields:

tblResources
==========
AutoNumber [PK]
RecordDate
Quantity
FiscalYear
BulkObligation
Project
Resource
Type
GeneralDescription
Subobligated
Liquidated

tblDocs
======
AutoNumber [FK]
FilePath
Description

What would be the best way to relate two fields in order to create a one-to-many relationship? If I link AutoNumber to AutoNumber, I can only get one-to-one. This makes sense to me. I've also asked myself why I would need them to be separate tables to begin with. Basically, tblDocs needs its corresponding form (sfrmDocs) to be continuous (in case many different files are associated to the record) and I'm quite sure I couldn't make only part of a form continuous. Can someone please suggest a solution?

Thanks.
You can't have an autonumber FK. Autonumbers are unique which you can't have if you need a one to many relationship.

tblResources
==========
ResourceID; AutoNumber [PK]
RecordDate
Quantity
FiscalYear
BulkObligation
Project
Resource
Type
GeneralDescription
Subobligated
Liquidated

tblDocs
======
DocID; AutoNumber [PK]
ResourceID; FK
FilePath
Description
Dec 14 '07 #2
You can't have an autonumber FK. Autonumbers are unique which you can't have if you need a one to many relationship.

tblDocs
======
DocID; AutoNumber [PK]
ResourceID; FK
FilePath
Description
I had tried this setup for tblDocs before, but I would get mismatched data types. It turns out I needed to make ResourceID a number data type to receive the AutoNumber from the preceding table. This seems to be working fine now. Thanks so much, Rabbit.
Dec 14 '07 #3
Rabbit
12,516 Expert Mod 8TB
Not a problem, good luck.
Dec 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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
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
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'...
0
by: Ray5531 | last post by:
I have two user control ,one is getting a vertical image and the other one is getting some rows from database and show them as bullet list.How should I put these two besides each other.I put them...
8
by: Agnes | last post by:
I got one dataset, one datatable, but two datagrids. I use dataview.rowfilter = 'sex ="F" and dataview.rowfilter = 'sex ="M" to filter the information and set to two datagrids's datasource =...
1
by: teddysnips | last post by:
Crystal Report problem - HELP! The fragments below come from two fundamentally identical applications. The one at the top - PrintEASAReport - throws an exception on the final line with the...
5
by: Peter Rilling | last post by:
Okay, the other day I was talking with someone about assemblies. He said something that I am not really sure about. He said that a DLL or EXE can contain more then one assembly (although the IDE...
41
by: Chris Lasher | last post by:
A friend of mine with a programming background in Java and Perl places each class in its own separate file in . I informed him that keeping all related classes together in a single file is more in...
1
by: ramkumar533 | last post by:
Hi all.. I am designig a form. its having a checkedlistbox control in vb.net2005 v1.2 . During the execution only one item should be checked at a moment. if one value is already selected,...
7
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.