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 Replies
ADVERTISEMENT
Mar 27, 2014
Is it possible to create a relationship between subform and a table?
View 1 Replies
View Related
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
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
Oct 8, 2014
I have a main form with several tabs. One of the tabs is a subform with just one number control, driven by a select query. The control shows a number, and you can type in a new number, which then updates the field in the table.
BUT, the control then shows a zero, it has moved to a blank record. If you enter a number again, it will attempt to write it to a new record.
So how do I display the number, and allow a new number to be entered that will update the SAME record, and not moved to a new record?
View 1 Replies
View Related
Aug 17, 2014
In my main form, there is this date entry selection and a subform with data on it.
How can I make the subform filter its data from date entry selection?
I have already created a relationships for my tables
I created a query for this subform (should I need to?)
It does not refresh my subform or I do not know what to do?
View 12 Replies
View Related
Apr 23, 2014
I have a form that request the User to enter a Parcel ID number (99-9a-99-99aaa-aaa-aaaa). The sub form asks for the subdivision number, block number, and lot number. The subdivision number, block number and lot number are normally part of the Parcel ID number but sometimes they can be different. I want the sub form to fill in the Subdivision number, block number, and lot number as a default but allow the user to change the value if needed. currently the sub form will only show what is entered into the table itself if a change is made on the main form the sub form does not reflect the change.
View 3 Replies
View Related
Dec 5, 2006
2 Subform problems
I have a data entry subform that is only supposed to show an empty record ready to be populated, and a display records subform that is supposed to show all the records. The subforms are both on the same tab of a tab control on my main form.
Problem 1:
The data entry subform shows all the records rather than a blank record. Something on my main form is causing it to show the records when it should not. Any ideas? The Data Entry is set to Yes.
To try to isolate the problem, I created a new form and added the subform to it where it behaves properly:confused:
I then added Me.DataEntry = True to the form open to see if that would solve my problem but it still sets the data entry to no.
If I have the properties box open when in form view of my main form, I can set the data entry to Yes and it works fine until I move to the next record of the main form when it resets to no. Teraing my hair out here.:mad:
My final attempt was to search the entire project to see if there is a "DataEntry = False" somewhere but there isn't. What is setting this property? Any ideas where I should look?
Problem 2:
After entering data in the first subform (data entry form), I want to re-query the second subform but I just can't get the syntax right. I have wrestled with the "Syntax for subs" document downloaded from http://www.mvps.org/access/forms/frm0031.htm (Microsoft MVP site) but to no avail.
My main form is called fdlgPrjDetails, the data entry is via fsubPrjCommentsUsersDataEntry and the subform I wish to requery is fsubPrjCommentsUsers.
None of the attempts below worked giving a cannot find control error.
Private Sub Form_AfterUpdate()
On Error GoTo ErrHandler
Me.Requery
'Me!fsubPrjCommentsUsers.Requery
'Me!fsubPrjCommentsUsers.Form.RecordSource.Requery
'DoCmd.Requery ([fsubPrjCommentsUsers])
'DoCmd.Requery [fsubPrjCommentsUsers]
ExitHere:
Exit Sub
ErrHandler:
MsgBox Err.Number & " - " & Err.Description & Chr(13) _
& Chr(13) & "Error in fsubPrjCommentsUsersDataEntry: Err 003"
Resume ExitHere
End Sub
Any Ideas?
Both problems have me stumped so I'll be grateful to anybody with a scoobie on this.:)
View 10 Replies
View Related
Jul 18, 2013
How can I get the value from a field in one table (in the sub form) to copy/insert into a field in another table (in the main form) when adding a new record?The main form and sub form are linked using parent/child linking, and the sub form is in a tab.I have table A (Visit Dates) in the main form which is used to record the date of a visit to a church. Table B (Quarters and Peals) is used to record an event that took place at that church during that visit. Note that not all visits in table A require a record to be created in table B - but half or more do.
In tables A and B I have a field called "QuarterOrPealID" and these are both primary keys, though the field in table B is set to 'no duplicates' and in table A it's set to 'duplicates allowed', as table A has its own auto number/pk. They are both linked in the relationships.
So, when I add a new record to table A using the main form, I might then need to click on the tab in the sub form to create a new record in table B, which has to be linked to the same record in table A. When the "QuarterOrPealID" auto number/pk is generated in the sub form (table B), I need that value to update to the "QuarterOrPealID" field of the main form (table A), so that when I'm viewing these records the form pulls all the information nicely together.
View 10 Replies
View Related
Sep 8, 2013
I am working on creating an access database for tracking physical assets linked to locations. I need to make a combo box list to show items other than the current location of the asset. Basically I need it to refer to last enery of the user and define the new possible entries. so we have a unique relationship between location and asset. The assets and location will always remain fixed and there is never going to be any addition. I am creating a web form so that it can be uploaded into sharepoint.
View 3 Replies
View Related
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
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
Jul 5, 2005
Hi,
I am assuming Access cannot handle Many to Many relationships very well.
I have an Account form ("MainForm") with an embedded SubForm that displays only the Account Address with suite number, street number, street name, street type. Account to Address is a Many to Many relationship. My Account form's source is tblAccount, and the SubForm is built off of a query of 3 tables -- Querying Account, LinkTable, and Address table. The link between the SubForm and the "MainForm" is done via AccountID.
My problem is, when I query for an Address (say entering a street number of 25), I want to get back all the addresses with street number of 25 AND the corresponding Accounts that have street number 25 only
What it does is return the addresses with Street Number 25 and ALL the accounts regardless of what their addresses are!
Is there a way to do this?? Can I design a form without using a SubForm in this case, ie, display the account and its many addresses? Or does Access Forms not support Many to Many Relationships? I'm thinking the link table is causing the problems here.
Please advise -- this "simple" project is becoming quite the headache! :eek:
"edit" -- I also notice this problem with a 1 to Many relationship (the "many" portion being the subform)
Thanks for any help,
Mike
View 3 Replies
View Related
Feb 27, 2006
Hey guy im kinda new to this program so excuse me if my question is simplistic:I built a form for making Purchase orders. In the main form...a user enters a bunch of text/num info (name, address, ect)into the table. After that i have it tab to a subform..where a user can add items by line (as many as they like). All good till here: Once i go to click out of the subform...i get message "You cannot add or change a record b/c a related record is required in table 'UCT_Req'"My relationship has a 'one-to-many' link (the req number to the many line items). I have auto-numbers counting up in each table.My main problem seems to be attaching the entered line items to a specific record in the main Purchase order form...and then opening a fresh form afterwards. Any hints?Thanks folksSTeve
View 2 Replies
View Related
Feb 20, 2006
I am having trouble establishing a subform connection (relationship) to a main form. I am using Access 2003.
I am creating a medical record database where I already have one form / subform relationship established that works. However, I created another form where I want to indicate the Physician(s) information within the main form and his specialties within a subform. I need to use the subform because one physician can have more than one specialty.
My fields within two tables are:
Doctor (Table)
ID
Doctor First Name (Key)
Doctor Last Name (Key)
Doctor Address
Doctor City
Doctor State
Specialty (Related Field)
Doctor Specialty (Table)
ID (Key)
Doctor First Name
Doctor Last Name
Specialty (Related Field)
The problem
I can’t establish the relationship.:confused: Also, when I look at my relation diagram – does each table have to relate to another? Can I have two separate relationships indicated?
View 5 Replies
View Related
Apr 27, 2006
Hello all,
I'm looking for a little help on something that I'm sure is an easy problem. I'm building a form for patients (data from Table: Patients) that contains a subform containing lab values (Table: Lab Values). I'm new at using subforms so I'm in a little over my head.
Both Tables contain the patients name to link them together. When I create the subform, I don't want it to display the patient name, because it is already displayed in the header. But if I don't include that field, I can't link the two tables together. I'm using one of Microsoft's templates off their website (called Contact Manager Database) as a guide, and it has exactly what I want - a sub form that only displays the relevant data for each patient, but when you add a record the data in the table automatically includes the name of the person.
I just can't seem to figure out how to do this. I'm sure I've been very unclear describing this, and I'm sure this is an easy task, but if someone can give me a little direction I would greatly appreciate it.
Cavy
View 3 Replies
View Related
Aug 29, 2006
I have a form with a combobox to select a clients name and that pulls up that client in a subform and shows various records for the client. But it always opens up showing the first record and I want it to open up showing a blank record for keying in more data i.e. after the last record.
Can you help at all on this?
many thanks
View 1 Replies
View Related
Mar 2, 2005
1st:
I have used the Lesban Rich Textbox Control. However, I face a problem with the control and cannot solve. The thing is that whenever I select an item from a combo box which loads a no record it refers to, it always ignore my first letter input. The second one will go just fine (e.g. when I enter ABC...., the control will ignore the A letter) Hope you get what i mean. I dunno if I made mistakes somewhere with the control. Does anyone have any idea that such thing should be done?
2nd:
In the same form as above one, I also designed 2 other subforms, however, it always raises error when I enter data while the main form contains nothing. I want to disable those 2 subforms when the main form record isn't filled out. I found a similar result in the forum, but it doesnot work with Rich Textbox Control's update event.
View 6 Replies
View Related
May 4, 2005
Hi
I have a form and sub form, the sub form is populated from a query and has a column of checkboxes. Basically these checkboxes get checked as part of the form, but only a maximum of five are allowed to be checked. Is there a way of achieving this?
Cheers
Dan
View 1 Replies
View Related
Aug 8, 2005
I haven't been able to figure out the code to require entry (for a new record) in a field on a subform - anyone can help with this?
The situation is a contacts database, and each new contact should have a (or multiple) Person Roles entered as well, which is their relationship to the organization.
View 2 Replies
View Related
Oct 2, 2006
Hi all,
I apologize if I'm missing something terribly simple.
Here's the background: I have a set of 3 tables linked to a main table based on a field called SampleID. I then have one main form (SAMPLE) with the other 3 tables (INDIVIDUAL, LOCATION & ORGANISM) all as subforms within the main form.
everything seems to work well in terms of links and getting the data into the appropriate tables and retaining the SampleID link. However, during data entry using the tab key, I am unable to find an eloquent way to move from the main form to subform1, then from subform1 to subform2, from subform2 back to main etc. I have set the tab order, and used the afterupdate control to change the focus which works, however as soon as I move from subform1 to subform2, the data just entered disappears from subform1. The data makes it to the table without any problem, but just blanks out the form.
From what I can see, when the subform loses focus it automatically saves the edited record and inserts a new record, thereby blanking out the fields that were just entered. Is there a property that can be set so that a new record is not automatically entered when leaving a subform? Is there a method to do this through coding?
any help would be greatly appreciated!!
Thanks in advance.....
View 3 Replies
View Related
Nov 14, 2012
I have the following Form and Subform. Form name is "100-Select Form". Subform name is "103-Report Dates". Within the subform I have two fields I'm using, "Start Date" and "End Date'.
In my query I have a date field. I want the query to read from the Subform (if I open the subform directly my criteria listed below works, but when the main form is open, my query doesn't seem to be able to read from the subform).
Here is the criteria I have in the date field of my query: >=[Forms]![103-Report Dates]![Start Date] And <=[Forms]![103-Report Dates]![End Date]
I have a feeling that I somehow should be pointing my criteria first to '100-Select Form', and then to '103-Report Dates' within that form, but I'm just not sure how to write this and nothing I'm trying is working.
View 2 Replies
View Related
Jun 23, 2005
Hi,
I have created a form with 3 subforms. This form is split in to 3 parts on a 3-page tab control.
I want the user to enter data in the order below. All fields are required. My problem is that Access97 wants all fields of the main form to be completed in the order set by the table. ie. before I fill in a sub form. I have tried setting the form tab order property but it is being overridden.
First page:
a) Complete first 6 fields of main form
b) Complete subform 1
c) Complete subform 2
Second page:
d) Complete 5th field of main form
e) Complete subform 3
f) Complete 6th field of main form
Third page
g) Complete three fields of main form
Any help appreciated,
Seth
View 1 Replies
View Related
Sep 6, 2005
I have taken the Order Entry database sample from Microsoft and have added a "Wizard" type interface.
Question) I'm having trouble understanding how to get more than one Feature applied to a single new service.
- For example, If I add a new SERVICE to an ORDER, and I need to add all available FEATURES to that SERVICE, how do I do that? *see my attached database & relationships. The form of FEATURES is also attached. I just want to be able to check off the ones that apply.
(is this many to many? I tried a junction table but can't make it work)
I would really appreciate some advice on my Forms, and definitely advice on my Table / Relationship structure.
ps: My tblServices use to be called tblProducts. I then added the tblCategories, tblPaid, tblTeleServ, tblLongDistRate, tbl800Serv & tblFeatures.
Thanks in advance for your help,
jlig
View 1 Replies
View Related
Oct 19, 2006
I have looked at multiple samples on this forum and others and cannot seem to get the result I want working.
Have main form TmLdr made from table of same name. Entries include ReqName and CostCenter. These same entries are on a subform. On the After Update event on the CoRecDt (main form), I want the name and CostCenter entered on the subform to populate on mainform. This subform will be filled out by the user once and as long as they are using their own machine there will be no need to re-enter their name.
I think that I am so close but just a touch away. I am attaching my DB with hopes someone can take a peak at it and let me know what I am missing. Thanks so much.
View 1 Replies
View Related
Jul 7, 2005
I have a main form where the user chooses a BoxID. There is a subform on this main form that has a relationship between BoxID on the main form and subform. The users are entering data in the subform and when they have entered 10 lines of info I have a message that tells them to start a new box (I could not work out how to do it any other way as I lack VB skills). The user closes the form or clicks add new record to create a new box. If I view the previous record there should only be 10 lines of information in the subform but there are 11 as it takes the blank line as a new record....
View 8 Replies
View Related