Forms :: Create Relationship Between Subform And A Table?

Mar 27, 2014

Is it possible to create a relationship between subform and a table?

View Replies


ADVERTISEMENT

Forms :: Trying To Create A Subform That Updates A Table

Jan 6, 2015

Here is the set up. I have a primary school database.

There is a main form that shows the students name and class.

The main form contains tabs for each subject (maths, english etc.). Each tab has a subform that is supposed to allow me to enter a comment about the student's progress.

My tables are set up properly (as far as I can tell).

The tables (simplified)

tbl_Students (has StudentID, StudentName)
tbl_SubjectList (has SubjectID, SubjectName)
tbl_Comments (has CommentID, SubjectID (foreign key), StudentID (foreign key), Comment)

The forms

The Master and Child (main form and subform) are linked using StudentID.

I use a query for fields in the Master form. Each subform has its own query that shows results for a particular subject.

The problem

My subform allows me to edit an existing comment fine (if I enter dummy data directly in a table).

BUT, if there isn't an existing comment, and I attempt to enter one, I get an error - "YOU CANNOT CHANGE A RECORD BECAUSE A RELATED RECORD IS REQUIRED IN TABLE tbl_Subjects."

What I have tried

I understand this error means I am violating referential integrity rules. But I can't see why. The tbl_Subjects is populated with 10 subjects and I am only trying to put a comment against an existing SubjectID.

I've checked that my Form Master / Subform Child is ok. I experimented with having StudentID _and_ Subject_ID to link the master and subform to see if that worked. It only made things worse because my subforms wouldn't display correctly.

View 5 Replies View Related

Forms :: Select Multiple Records In Subform To Create New Table

May 21, 2013

I need to create some new records based on main form data and a selection of records from a sub form. The main form and sub form have different sources. I wanted to show the source fields in the sub form along with a check box to allow the users to select individual records. The record source for the sub form contains >1000 records, so the user will first enter data in the main form, use filters to find the records he wants to 'assign' to the main form data, click those he selects, then click a command button in the main form to create the record(s) based on the main form data and the selected records from the sub form. The new records will be appended to a new table.

View 6 Replies View Related

Create Relationship Between Multiple Field Primary Key And Another Table?

Aug 4, 2015

In table 1 fields Factor, Aggregations, Stat, and Days Back are fields that make up a multi-field primary key [URL].

I want to create a relationship between that multi-field primary key and another table, call it table 2, and make it a one-to-one relationship.

How do I do this in MS Access 2013?

View 3 Replies View Related

Forms :: Subform Relationship With New Entry

Mar 28, 2014

I have a Workorder Form that holds all the fields that apply to the entire project (payment, customer, etc).

Then I have a subform for Stock. This allows there to be several different stock items (and production information relevant to that stock) assigned to a Workorder.

I have successfully linked the two so that when a Workorder is opened, it shows any related Stock in the subform that has already been created.

The problem is new stock entries. I need it to only allow Stock additions to the current open related Workorder.

I currently have it where you can type in the WorkorderID (autonumber) on the Stock subform new entry and it will work. But I do not trust employees to type in the correct number every time they need to add stock to a Workorder. I can't release it this way.

I mean, the whole point is for the database to promote as little error as possible, right?

View 5 Replies View Related

Forms :: Subform To Popup Relationship And With Refresh Of Calculated Field

Apr 3, 2014

I have a "Main" form called frmProjects that sports multiple tabs. One of those tabs is labelled "Milestones", into which I inserted a datasheet subform called frmSubMilestones. The table that feeds the subform is tblMilestones. I established the parent / child relationship between frmProject and frmSubMilestones, and everything is working just fine...

To summarize: frmProject as main form -> Milestones Tab on main form -> frmSubMilestones as datasheet subform on the Milestones Tab (there are other tabs that are not subforms).

I have been asked, for each milestone in the frmSubMilestones subform's datasheet, to capture the number of days spent by employees on a monthly basis. The Milestones table and the PersonDays table have a primary key and a foreign key that are similar.

To summarize: frmSubMilestones as subform -> txtAggregatePersonDays as calculated Textbox fetching data from tblPersonDays -> OnClick event -> FormLoad of frmPersonDays as datasheet PopUp form.

DoCmd.FormLoad is supplied with the usual parameters to make the PopUp form appear, filtered on the currently highlighted milestone. Everything works fine so far... well almost.

Problem 1: When I introduce new rows in the frmPersonsDays datasheet, everything seems fine at the surface, BUT the primary key of the calling form (i.e. frmSubMilestones) does not appear in the tblPersonDays table; this is normal because there is no form-based parent / child relationship between the two forms. As one might expect, I am trying, from frmPersonDays, to get the primary key value from the "parent" frmSubMilestones using the Forms collection. No dice. I surfed and surfed, tried the bang and the dot operators, drank scotch, but nothing worked. I had to add foreing keys manually in tblPersonDays to further my tests. I can't figure out how to reach any control on the calling form, which is a subform.

Problem 2: The calculated txtAggregatePersonDays on the frmSubMilestones works wonders for existing data in tblPersonDays. However, when I introduce new rows in the PopUp form, I also realized that the calculated Textbox in frmSubMilestones is not updated when I close the frmPersonDays PopUp. I have to close the PopUp form and move the cursor in the Main form (frmProjects) to refresh its associated milestones.

View 3 Replies View Related

Forms :: Navigation Combobox Ignoring Subform Master-child Relationship?

Jun 17, 2015

I have a form, frmProjects, with a continuous subform, sfrPeopleOnThisProject. They have a master-child relationship. The form shows one Project record at a time, while the subform shows all the People records for that project. This works as expected - the correct records show up in the subform as you move through the form records.

To make it easier to glance through the list of subform records (as they can sometimes be quite long), I've added a navigation combobox to the header of the subform. If I understand correctly, as the combobox is within the subform, it should obey the master-child relationship: it should only show the subform records associated with the main form's current record. It does not. Instead, the combo box collects *all* of the records from the table that the subform is based on. So, choose the record for Project 1 in the main form. Up pops the 2 people on Project 1, but the combo box lists both the 2 people on Project 1 and the 3 people on Project 2.

The row source for the subform combo box is:

SELECT tblPersonOnProject.PersonOnProjectID, tblPerson.Fullname FROM tblPersonOnProject INNER JOIN tblPerson ON tblPersonOnProject.PersonFK=tblPerson.PersonID ORDER BY Fullname;

I can make the combo box perform as required by adding "WHERE Project=Forms!frmProject!ProjectID" to the row source and placing a hidden textbox on the main form for ProjectID (the autogenerated primary key) to sit. Have I misunderstood the point of the master-child relationship in the subform? This hidden textbox thing can't be correct.

View 2 Replies View Related

Won't Let Me Create Relationship

Sep 25, 2006

Structure of db

tables
divs(divid, div, div_short, div_num)
subdivs ( subdivid, divid, subdiv)
issues (issueID, issue, issueName, subdivid)
subIssue1 (subissueID, subissue, issueid)
subIssue2 (subissue2id, subissue2, issueid)
resolution (resID, labeltext, subIssueID)
resolutionlink( resID, labeltext, linktext, navURL, suIssueID)

relationships
div and subdiv (1 to many)
subdiv and issues (1 to many)
issues and subIssue1 (1 to many)
subIssue1 and subIssue2 (1 to many)

Now resolution table could have a one to many relationship with either issue table, subIssue1 table, or subIssue2 table. When I go to create any of those relationships, Access won't allow me. Tells me it can't create this relationship and enforce referential integrity.

Possibly I need to restructure my database to accomodate?
I am not sure, any help would be appreciated.

View 3 Replies View Related

How Do I Create This Relationship

Dec 7, 2006

Could someone please help me with the following problem.


I have a report that downloads into excel from a loan software program.

The report has lots of data for each individual loan number


What I have done is link this report to access as a table.

The problem I am having is how do I create a relationship with that table.

I want to create a status report that does the following

There are about 15 steps in the loan process, and I want to add 3 fields to link to every loan number (possibly a subform)

description of event
is it completed(y or n)
date completed

can someone please help me with any ideas

thanks

Josh

View 5 Replies View Related

Trying To Create A Relationship Between Two Tables

Jun 4, 2007

I am a newbie to access and i am working on a project that has two tables
the primary table has for example the following fields:

firstnameID(primary key) data type auto number
Firstname data type text

the second table has for example :
LastnameID(primary key) data type auto number
Lastname data type text
FirstnameID (foreign key)data type number

I created a relationship between the FirstnameID in the primary table and the FirstnameID in the second table ..
My problem is this whenever i try to view the relationship when i open the primary table it don't show the relationship ,
The Field FirstnameID in the secondary field is always Empty the only time the relationship is created is when i manually insert the autonumber that is generated in the FirstnameID field , but i thought that since a link was created then that field would have automatically be inseted with data , am i assuming wrong or am i doing somethingn wrong? how do i get the autonumber to be inserted in the field automatically to create the relationship?
Please Help

View 3 Replies View Related

Noob With Access - I Need To Create A Relationship?

May 20, 2007

Hi

Im building a web application to control the stock of a small company.

I already made the database with all the items and descriptions in one table.

This table would be the main warehouse. so now i have to create 3 different departments in different tables where i have to move stuff from the main warehouse.
So if i have 10 boxes in main, and i move 4 to department1. then i would get 6 boxes in main and 4 in dep1.


My web app would be constantly updating the stuff being sold in departments 1,2,3.... so here is my question.

how do i make the database to update the quantities by itself in the main warehouse table if department X sells anything...?

Like in Excel, when you work with different sheets that can update the other ones if you change a number. the rows can be linked... can i do this in access?

Otherwise i would have to write a lot of extra SQL code in the ASP scripts and im really out of shape cause i don't program in ASP sisnce very long time ago... years.

Thanks!

View 3 Replies View Related

Forms :: Create A Filter To Eliminate Any Record From Form Where Nothing To Show In Subform

Jun 7, 2013

I've got a hopefully an easy question - how to create a form filter? I've got a form with a subform. Form is showing all records from a table, but some records on the subform are blank. I want to create a filter which will eliminate any record from the form where there is nothing to show in the subform.

View 8 Replies View Related

Forms :: Create New Record In Form - How To Requery Subform To Link Properly

Apr 2, 2013

I have a form (frmAddManifest) with a subform (subfrmManifestTransporters).

When creating a new record, I can enter data into frmAddManifest, but the subform doesn't update to link with the record - I presume it's because the record from the main form hasn't been completed yet.

Is there a way to requery the form and/or subform so it stays on the record I was working on, and link the subform properly?

View 4 Replies View Related

Create Query With Multiple Criteria From A Many To Many Relationship

Sep 23, 2004

Alright I've been picking my brain for the past hour trying to figure this one out...

I have 3 tables...
1) Retailers-RetailerID, RetailerName, address etc. (500 entries)
2) Distributors- DistributorID, DistName (10 entries)
3) Uses- RetailerID, DistributorID

Sample data is as follows for 'Uses' table:
RetailerID DistributorID
1 1
1 3
2 1
2 6
3 4
3 5
4 8

I am trying to create a search form based on a query which will return retailer information for those retailer who use multiple distributors.

For Example...There will be 2 text boxes and a user can enter a distributorID in these text boxes. If only 1 distributorID is entered, it will display records for that one.

I have tried the following but I have been unsuccessful:

SELECT Uses.RetailerID, Retailers.Address, Count(Uses.RetailerID) AS CountOfDistributorID
FROM Retailers INNER JOIN (Distributor INNER JOIN Uses ON Distributor.DistributorID = Uses.DistributorID) ON Retailers.RetailerID = Uses.RetailerID
WHERE Uses.DistributorID = 1
GROUP BY Uses.RetailerID, Retailers.Address
HAVING Count(Uses.RetailerID) > 1


Is this possible to accomplish with the way I designed this database? If so, can I get a little advice? I know this is a long question that can't be answered in full but I would just need to basics in order to be on my way.
Thanks in advance!

View 1 Replies View Related

General :: How To Create Relationship With Duplicate Records

Mar 21, 2014

See attached picture where I am stuck at?

I have a table that holds UK Postcodes and a customer table that holds customers.

I am trying to create a relationship between the 2 so when I enter a postcode in the customer table this is then related to the postcode table.

The main problem I have is that there is a lot of duplicate postcodes in postcode table so the primary key is simply a number as you will see in the picture.

View 2 Replies View Related

Queries :: Append Query - Unique Records To Create Relationship

Mar 22, 2015

I have created a linked Excel table in Access 2010 called 'tblExcelLinked' and I have a form called 'ASB Log Form' for the purposes of presenting the data in a more readable manner that is easier to view, plus link other fields of data that are not directly related to the 'tblExcelLinked'.

Because there is no unique ID in the 'tblExcelLinked' to create a relationship, I have created a table called 'tblASB', which allows me to add other table data linked from same d/b.

I now want to update the 'tblASB' with data from the 'tblExcelLinked', but only append new records from 'tblExcelLinked', but my inadequate append query is duplicating the records each time I run it, rather than just adding the new ones.

Once sorted my next challenge is a macro so that this runs automatically rather than being manually triggered.

View 3 Replies View Related

Forms :: Can Create A Table From A Form

Dec 17, 2014

I am having an interesting time on a project. I am trying to create a small inventory management database with BOM (bill of materials) control.Today I am working on how to create the BOM's. In case your not familiar with inventory management, a BOM is basically a list of items and quantities used when creating a product.

Since it is possible for a single BOM to have over 200 Items associated with it, I can not have a single table with all my BOM's (fields max at 255)
So I was thinking I would be able to have a Master table with the BOM list and then create individual tables for each specific BOM.I am not 100% sure how to make this all work together but I am struggling forward on my quest..

I was hoping I could create a form for BOM management, (create/edit/delete) but since I can not keep the BOMS in a single table I would need this form to create the new table.

Is it possible for a form to create a table? or do I have to create the table first than have a specific form per table to do the editing? or perhaps a drop down selector to choose which BOM/Table I am working on.

View 9 Replies View Related

Relationship Btw Form And Subform

Jan 25, 2008

Hi,

I have a main form (stud_details) also I have a subform called (pay_det_sub).The subform is displayed on the main form.
I want to create a relationship between the stud_details and pay_det_sub, with the aid of a field on the stud_details called numhus (which is the primary key).

So that when a student with a specific numhus value is displayed it brings about the payers details on the subform.

What's the best way of doing it??? Is it necessary to have numhus value stored also in the subform table to create a relationship....

Thanks

View 3 Replies View Related

Multiple Relationship Subform

May 7, 2006

Hi. can anyone help me. I've spent the last two hours getting no where.

I have a tbl_Enquiry,tbl_EnquiryType and tbl_Questions
On the main form (frm_Enquiry), depending on which enquiry type is chosen, will depend on which questions are displayed.
this is a many to many relationship so I have a junction table, called tbl_TypeQuestionJunction.

The questions are displayed in a sub from when the enquiry type is selected, and this all works fine.

However, I then need to add a field where the user can write thier answers to the questions.
for this I have a table tbl_QAJunction with the fields
EnquiryID
QuestionID and
Answer

How can I get my subform to display the correct questions when the enquiry type is selected, with an answer box next to it and then pick up the EnquiryID, QuestionID and the answer and add them to the tbl_QAJunction.
I just can't get a query to work.

I hope this makes sense

This has really bugged me and is stopping me completing my database.
Am i going abotu this all wrong? If anyone can help, I'd be grateful
I've attached a cut down version of the DB so you can see what i'm on about

Thanks

View 7 Replies View Related

Forms :: Create A Table From Unbound Form

Feb 2, 2014

May not be using the correct terminology here. I have a form that currently does not have a RecordSource. From this form, I want to create a table called "ICEA" with the following fields (which would be entered from the form): OperatingDay, Hour_Ending, Import, Export, and Net.Can this be done with a SELECT statement or does it have to be done through VBA?

View 4 Replies View Related

Forms :: Create One Record In One Table And Multiple In Another

Oct 8, 2014

I have two tables which are in a one-to-many relationship (the example I am dealing with is a mother and her children).

I want one form for the mother, with fields such as date of birth, and when you click Add Record I want the mother table to be updated with the new record.

However on this form I also want a field for "number of children" and when the Add Record button is clicked, not only does the table containing all the mothers get a record added, I would like XX records added to the children table where XX is the number of children entered into the form. These should have separate IDs but retain a common field that identifies the mother.

View 2 Replies View Related

Queries :: Create And View Both Forms Using Same Table

May 23, 2013

I am using a query as part of a mail merge, there are two forms that use the query, create and view, both forms use the same table. When I click the print button the query runs, and mail merges in a word document.

What I need is a filter on the query which only shows the record currently open on which ever of the forms is open, so the mail merge only happens for the 1 record you want.

View 4 Replies View Related

Forms :: How To Create A Field In Table Automatically

Jun 29, 2015

I have a form and it has a field as question. I also have a field as I'd in this form from the same table that is autonumber. I want that for each field the question will be created automatically in the table as below:

Is epm ( my Id field) is created
Is epm and is created are string

They should also include Id number of each row. So It would be like:

Is epm -1 implemented
Is epm-2 implemented
.
.
For each row

View 7 Replies View Related

Forms :: Create Table Based On Textbox?

May 1, 2015

I have a userform that has 4 textboxes and a command button.

The user types in box1 a Rack, in box2 a shelf, in box3 a place and in box4 a shelf.

The user types in Rack textbox 18
The user types in Bay textbox 4
The user types in Shelf textbox 2
The user types in Place textbox 3

I then would like to create that amount of records in a new Temp table.

The attached file shows what the results of the output should be.

View 8 Replies View Related

Forms :: How To Create A Form With Junction Table

Feb 3, 2014

trying to understand how to create a form with a Junction table. This design will allow a book to have more than 1 author.

Author table
Author ID
AuthorName

AuthorID table (Junction table)
AuthorFK
BookFK

Book Table
BookID
Book Name

Author table has a 1 to many relationship with AuthorID table and Book table has a 1 to many relationship with AuthorID table. Now how do you create the forms? Do I need a main form FrmAuthor , subform FrmBook and a frmAuthorID

View 8 Replies View Related

Forms :: Get Date Create In Renaming Table

Jul 18, 2014

All, using access 2010. I have some code to rename a table in my database. Partial Code:

Code:
TableDefs("tblMstr").Name = "tblMstr" & Format(Date, "yyyymmdd")

This works but how do I use "datecreated" to get the creation date of the table and format it. I tried to use DateCreated in place of Date but get errors such as variable not defined or .datecreated without a with block.The result I'm going for is something like "tblMstr20140603".

View 5 Replies View Related







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