Add Data From Two Subforms Into One Record.

Sep 9, 2005

I have two subforms on a tabbed page. Both subforms read/write data from the same table. The first subform is in dataset view and consists of 5-6 fields on the line containing class information. The second subform consists of two memo-type fields where users can enter comments. The fields from both subforms should be written to the same record in the table. The problem is that
the information from the second subform is being written to a different table record; it is creating a new autonumber. The data is being written to two separate records instead of being combined into one.

How do I link the two subforms so that the data gets written to the same record in the table so that the class information and it's related comments stay together?

View Replies


ADVERTISEMENT

Check Data On Leaving A RECORD- Record, Subforms And All

May 24, 2005

I have an application that enters candidates in, who apply for a job.

I found that I can enter a candidate in, and if I dont enter at least an address type or phone type ( giving that candidate an address record, albiet a blank one (just a type of address) and a phone record) then the candidate wont have a sub record for addres or phone at all.

This is hurting my reports. They are set to pull the primary address and phone only, as we dont need to have 2-3 contact information for a candidate on a report This is how I found out that I had blank address and phone for some test records. I need to be able to check when a person does a number of things, that at least the combos for phone type and address type have been chosen as something. This will ensure that they have a primary address and phone, as I have code that takes care of all that. I tried putting the following code in the form's before update, but since it is calling to a subform, the minute I tab TO the address combo, I get the message. The form is updating before I get the chance to skip the field.


Here is the lay out. A user can enter in candidate, their address, phone, application and activities. Address, phone, applications and activities are all sub reports on a tab control. The user should be able to move freely within any record, and only be bothered when they try to leave, if important information is still empty. I dont want to control how they enter ('you must enter this first!' lol) just that they do enter it in the end.

What I want to do is check when the user is leaving a record.(closing form, going to another record, clicking the search button that opens another form etc) if either combo is empty (no primary contact info) then it gives the message and goes back to the combo that is empty.

Here is the code I have. If anyone can help me find the right place to put it, I would really appreciate it. Thank you,



If IsNull(Me.[subAddressEntry].Form![cmbAddressTypeID]) Then
msgbox "You must enter an Address"
Me.[subAddressEntry].Form![cmbAddressTypeID].SetFocus
Cancel = True
ElseIf IsNull(Me.[subPhoneEntry].Form![cmbPhoneTypeID]) Then
msgbox "You must enter a Phone"
Me.[subPhoneEntry].Form![cmbPhoneTypeID].SetFocus
Cancel = True
Else: Cancel = False
End If



If I can't figure this out, I am thinking of making a new address type and phone type. Call it "none chosen" and then make that a default selection. Then one would always be chosen...I think. I would like to avoid that though.

Thanks again.

View 3 Replies View Related

Subforms Not Showing If Record Blank

Sep 23, 2005

Have a strange problem. I've created a form with multiple subforms and if there is a record for the subform to display everything looks fine. However, if there is no record for the subform it does not show anything on the screen or if printed.

I would like for the fields on the subforms to show no matter what but I can't figure out why it doing this. I've checked the display parameters and everything is set right.

How do I make the forms show no matter if there is data to display?

Any help is greatly appreciated -

Thanks

View 2 Replies View Related

Subforms & Limiting Record Entry

Apr 28, 2006

Hi guys,

What would be the best control source to use for my sub forms detailed below:

I am designing an Asset Management System. Each the main Asset Table "TblAssetMain" has child tables "TblAssetType", "TblAssetDetails", "TblAssetEventLog".

When a new asset is created, the AssetMain form will have subforms for these three child tables (linked by Asset_ID = Subform![Asset_ID]).

Can I use a query of the child tables for data entry or, if I set the control source to the actual tables, can I limit the number of records in the child tables for each record in the Asset Main table to "1".

Basically each Asset will have one record in AssetMain and 1 relating record in each of the child tables i.e. you cant have more than one AssetDetail record for one Asset.

Did do a search and found the following code but not sure whether there is a way without using code?

Code:
Private sub Form_BeforeInsert(Cancel as Integer)
If Me.txtCount > 2 Then
Cancel = True
Me.Undo
Msgbox "Please return a book before checking out a new one", vbOKOnly
End If
End Sub

View 3 Replies View Related

Command Button - Add New Record To 2 Subforms

May 13, 2006

Hi,

I have a form that contains 2 subforms:

Purchase Order (Supplier, Order Date, Tel etc)
Purchase Order Details (Item Description, Quantity, Price etc)

This way I can have several items in 1 purchase order.

I now need to create a 'New Purchase Order' button. I've tried doing this but it only creates a new record for the form where the button is placed i.e. if the button is in the 'Purchase Order' form a new record is created for Purchase Order but NOT purchase order details.

Is there a way I can get the button to add a new record to 2 forms at the same time?

Thanks

View 1 Replies View Related

Forms :: First Record Not Displaying In Subforms

May 15, 2013

I have a form with some tabbed subforms. Master/Child links are set, everything is bound. When I open the form to display records (based on search criteria on the switchboard form), let's say it returns 6 records for someone, they are sorted by date and so the newest would display first.

But when it opens, the main form shows all the appropriate data, but the subforms don't show at all. Just a blank box where the subform control should be. If I click next record (and any thereafter) they all display correctly immediately. Now if I go to the 2nd record, then back to my 1st record, it displays correctly.

I'm guessing it must have something to do with the onLoad event of either the main form or subforms, but I don't have anything in there for OnLoad....no code at all.

View 8 Replies View Related

Switching Subforms Based On A Record Selection

Jan 18, 2006

Right slightly complicated (in my eyes) and I have not found anything in previous threads to help but here goes:

I have a main form (FRM_SUMMARYREVIEW) that has an unbound subform field on it (subfrmmaster).

When FRM_SUMMARYREVIEW is first opened subfrmmaster has its sourceobject set to a form called FRM_OPENSUMMARY.

This subform lists all my open escalations, in a continuous forms format and has a field in it called "escalationid" and when I click this field "subfrmmaster" changes it's sourceobject to another form called FRM_MAINDATA and should display the data relevant to the escalationid I have just selected.

In the past I used to click on "escalationid" and it opened up FRM_MAINDATA as a new form, using the following code:

Dim Searchstr2 As String
Searchstr2 = "[Escalation ID] = " & Forms![FRM_SUMMARYREVIEW]![FRM_OPENSUMMARY].Form![escalationid]
DoCmd.OpenForm "FRM_MAINDATA", acNormal
Forms!FRM_MAINDATA.Filter = Searchstr2
Forms!FRM_MAINDATA.FilterOn = True

However how can I get the subfrmmaster sourceobject to change and display the relevant escalation detail ?

My other option is to have two subforms on the main form, one with "FRM_OPENSUMMARY" the other with "FRM_MAINDATA", as "FRM_OPENSUMMARY" has a list of escalations displayed, in a continuous forms format could I set it so as I arrow down the list, the data in FRM_MAINDATA displays the highlighted escalation in "FRM_OPENSUMMARY".

I hope this makes sense

MattP

View 5 Replies View Related

Tabs, Subforms And No Data!

Jul 5, 2006

I have a form with two tabs... Its record source is Person and Account.
The main tab has a load of fields relating to the person and the other tab is meant to show the bank accounts that the person has in a subform. However if there is no bank account for the person then nothing will show in either the subform or on the person tab.

I have checked throughly to see if there is anything saying
SELECT Person.*, Account.* WHERE PersonName = etc
which would only get the account and person details if personname was there.

The form is accessed by means of a search form which opens the form like so.
DoCmd.openForm "PersonAccount", , , "[PersonName] = '" & personName.Value & "'"

So any ideas why nothing at all shows not even the Person details?

View 3 Replies View Related

Forms :: Set The Size And Print Current Record With Subforms

May 30, 2014

I have a form that has 2 subforms. When I try to print the current file there are a few problems,

1) When you use the print option in File menu, and select "Selected Records" , it will always print the second record, no the one selected.

2) No matter how often I change the printer properties , it will not keep the paper size I request.

Is there a script I could use to set the size and print the current record ?

View 1 Replies View Related

Forms :: Take Data From A Form With Many Subforms

Dec 6, 2013

I need to take data from a form with many sub-forms. The letter has to be in word to allow for edits. Its an appointment letter, however is has a table with 1-100 lines.I need to be able to add the name, address, date of appointment and table with however many lines are needed for that client.I can get the table to work by itself or the name, address and date of appointment but not both.

View 5 Replies View Related

Updating Subforms As Data Is Added/deleted

Sep 6, 2005

I'm new to form design and do not know any VBA (but that won't stop me from messing with the code when need be).

I'm creating a form that will serve as the user-interface for viewing, adding, and deleteing data.

The product I want is a form with 3 items: a subform that displays data in a table (so users can see all the data), a button that links to a second form for adding data, and a button that allows users to delete data.

I've gotten close to accomplishing this with the exception of the delete option. The hang-up is due to the fact that the subform that displays all the data is the output of a query (can't delete data through the query). A friend who used to work with Access years back was trying to solve this issue by writing code that would identify the primary key of the record selected in the subform/query and then adding code that would use this extracted primary key to delete the record in the original table.

This seems like a slightly convoluted approach. Any suggestions how I can get the product I'm looking for?

Thanks,
Phil

View 14 Replies View Related

Handling Errors In Subforms And Clearing Data

Jul 8, 2004

Picking up on some previous conversations with people, I have a form (Interconnect Register) within a database that I am trying to add a "cancel" button to which would close the form without saving. I can do this now, but the problem is there is a subform (Sheetsubfrom) within the main form. I have struggled to get the subform data to clear (was trying to use the DIRTY property but it wouldn't work - believe me, spent ages on it!) but have now got the following in place which I thought would work.


Private Sub Command41_Click()
Dim retval As Integer

'Check main form
On Error GoTo Sub_Form:
Forms![Interconnect Register].SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

Sub_Form:
On Error GoTo Error_Handle:

Forms![Interconnect Register]![SheetSubform].SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close

Error_Handle:
DoCmd.Close
End Sub



The problem has come full circle, in that when nothing has been changed ie nothing to cancel, an error occurs saying "nothing to undo". I believe this is something to do with having an error handling procedure nested within another error handling procedure, as from what I can make out from the help files Access backtracks to the level above. So when I have an error in the Sub_Form part, the whole thing crashes.

Any ideas guys and gals? I could try posting then DB on here if that would help, providing I can zip it up ok

Thanks

Ian

View 11 Replies View Related

Forms :: Subforms And Many To Many Relationships - Data Not Retained

Jun 4, 2013

I have created a form with two subforms. The context of this is a litigation database. The main form is for testimony. Among other things, it includes a field for a question and an answer. Any given piece of testimony may relate to one or more documents, and any document may be referenced in one or more pieces of testimony. So have two subforms, one for documents produced by the Plaintiff, and one for documents produced by the Defendant. It worked out easier that way because I originally created indices of those documents in separate Excel tables which I then imported to Access.

So the relationship for both document tables relative to the testimony table is many to many, which is established using two junction tables.

I also have a combo box in each subform where I can autofill fields based on selection of the document number.

My problem is that while the combo-box works great, once I select a document in the subform, that selection is carried over into the next entry of the master form, but also the selection is not retained in any of the master forms. So I can browse the document listing from any entry in the master form, but I can't get the document selection in the subform to stick and create a lasting relationship to a given record in the master form.

Is my problem that it is just impossible to have a subform based on a many to many relationship, or is it in the parent child relationship of the form and subform, or is it in the properties of the subform?

View 13 Replies View Related

Tables :: Corresponding Data In Combo Boxes And Subforms?

Sep 27, 2013

I have a field showing who equipment is being distributed to pulling data from my US Employee table. If I make it to only the last name from my lookup

(SELECT [US Employees].[Last Name], [US Employees].[First Name], [US Employees].[Dept] FROM [US Employees] ORDER BY [Last Name], [First Name], [Dept])

I can also view the equipment listed under the individual it is assigned to on a subform on my US Employee table. If I try to have the first and last name displayed on my Equipment table, however,

(SELECT [US Employees].[Last Name]&", "& [US Employees].[First Name], [US Employees].[Dept] FROM [US Employees] ORDER BY [Last Name], [First Name], [Dept]; )

it will not display under the individual on the US Employee table. Is there a way around this without having to combine the fields on the employee table or separate them on the equipment table?

View 8 Replies View Related

Adding Data To Multiple Tables With Subforms

Mar 2, 2015

I am new to access but I am familiar with SQL databases. I have two tables: one for project data and another for project leader data. These tables are linked by a third table that relates projectIDs to leaderIDs. I am currently working on making a form that will go through each project and display the people involved in each project in a subform. I pulling the data from the the leader table that matches the the projectID with a query.

I would like to be able to update the information in this subform directly (which I can currently do) and be able to add new project leaders to a project. What is the best way to add the new leader to this? If a person is already in the database how do I add them with the form without re-adding new information to the table?

View 3 Replies View Related

Forms :: Hide Number Fields Of Specific Record On Continuous Subforms

Mar 8, 2014

I have a continuous subform recording the information of various wireless products for an employee embedded in an employee main form. Please see screen shot enclosed.

There is a check box "BYOD/Personal" on the subform. I want to hide a number fields when this check box on independent record is checked. However, if I use the following codes, the changes apply to all records under that employee.

Private Sub BYOD/Personal_AfterUpdate()

If BYOD/Personal.Value = True then
Me.Provider.Enabled = False
Me.XXX.Enabled = False....etc.
Else
Me.Provider.Enabled = True
Me.XXX.Enabled = True....etc.
End If
End Sub

How can I just disable those fields on the subform of a specific record when the BYOD/Personal field for that record is checked?

View 8 Replies View Related

Forms :: Main Form With 2 Subforms Fails To Open Current Record

May 12, 2014

I have a main form "frmDriverNoticeRecord" with 2 subforms, "frmSubDriverNotice" and "frmSubVehicleRecord"..The main form uses "IncidentID" as the PK. Each form stores data in its own table. The tables are related via IncidentID and there is a 1-many relationship between tblIncident (main) and tblDN (sub) and tblVehicle (sub).

I have a form "frmIncidentLog" displaying records in a table view with a few fields for quick reference and to allow selection of a single record for detailed viewing. I created a command button with the intent to open the "frmDriverNoticeRecord" at the current record. The main form and child link fields appear to be linked correctly; i.e. IncidentID on all three. If I open the form manually it opens and I can use it and search and filter as I want. If I try to open it via the command button It opens a small window asking for the IncidenID, when I enter theIncidentID number, it opens the form to the first record every time.Here is the code:

Private Sub comOpenDR_Click()

Dim frmName As String
Dim recID As String
frmName = "frmDriverNoticeRecord"
recID = "[IncidentID]=" & Me![IncidentID]
DoCmd.OpenForm frmName, , , recID
End Sub

I tried running the the DoCmd.OpenForm command directly from the button using the where condition (in various manners) with the same results.

View 13 Replies View Related

Tearing Hair Out - Data Entry Forms/Subforms

Jun 18, 2006

Hi Guys,

The asset managment system I have been developing is due to go live next week and I am really struggling with the data entry and search forms.

I have attached a picture of the main form (and outlined each subform) to give you an idea of my project.
The attached form is actually a Main Equipment Type Detail form with a child subform AssetMain which has a number of child subforms i.e. Asset Details, Purchase Details etc.

When a user clicks to add a new asset a popup form asks them to select an equipment type i.e. PC. When they click it opens the attached form. Their selection filters the equipment type detail values in the combo i.e. Laptop, Tower, Server etc.
When a value is then selected in the combo you can then add an asset for that equipment type detail. (One Equip Type > Many Equip Type Detail > Many Assets)

1st Problem)
I have set the Asset Main subform to allow additions only. When the whole form opens, the Equipment Type combo (at the top) does not display a value but does actually contain the first value.
How do I force my user's to select a value in the combo before it actually filters the child subform?

2nd Problem) The Asset Main Subform (filtered by selected Equip Type) should only be used for data entry. I set the data entry property of the form to True but when the value in the Equip type combo changes, it displays all the relating records in the subform. My only solution so far is to stick

Subform.DataEntry = True
in the Equip Type combo's after update event. However, this doesnt look to good as it flashes up with the data and then displays a blank record.
Any ideas?

3rd problem) Due to the fact that I am using a number of subforms, my tab order is such that values are entered for the main form (i.e. ID, Condition) then subforms (i.e. manufacturer) then back to the main form (i.e. allocated to). This means that:
a) I am having problems validating the record beforeinsert as I have had to change the required property to "no"
b) Once the user has tabbed through all the forms what is the best way to go to a new record? Alternatively if I add a new record button I need to check that the necessary fields have been filled in (on all of the forms/subforms).

and finally the 4th)
I have a search form that queries the assets. The search results are displayed in a list box. When you dblclick the list box I need to show the asset details.
Question: Can I use the above form to do this? My only problem is that I need to open the AssetMain form which is a sub form in the above. If I try and use the existing form it will not open as many of the controls refer to the form as a subform. Do you think I need to create a separate form for showing the data to entering it?

Would really appreciate some help (not that you havent heard that before :) )
My head is going to pop in a minute!!!

Thanks
Ben

View 5 Replies View Related

How To Link Subforms To Other Subforms On An Unbound Form

Feb 4, 2006

I forum could someone tell me:

I have an unbound form on that form I want to put three sub forms one on a products table the other on a course start dates table and the link table that joins the other two together. all three are related to each other with Pk/FK links.

When I try to link them it says you cannot link items on an unbound form.

regards in advance
Peter:eek:

View 1 Replies View Related

Forms :: Lock / Unlock Form AND Subforms From Editing Data

Mar 24, 2014

I have a form with several subforms within (tabbed subforms). I've used the code:

In the Current event of the parent form -

Code:
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False

In the Current event of each of the subforms -

Code: (THIS NEVER WORKS FOR ME - RUNTIME ERROR)
Me.AllowEdits = Me.Parent.AllowEdits
Me.AllowDeletions = Me.Parent.AllowDeletions
Me.AllowAdditions = Me.Parent.AllowAdditions

In the Click event of the button -

Code:
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True

So the main form is locked upon opening and unlocked with the click of an unlock button. How to apply this to the subforms as well. They just stayed unlocked the whole time.

View 14 Replies View Related

General :: Make Mainform Field Required To Enter Data Into Subforms?

Aug 7, 2015

I need to make my mainform fields required before any data can be entered into subforms. Mainform and Subforms are linked with LinkMaster Child ID. This should only be applied in this form.

View 4 Replies View Related

Moving Data Between Subforms & "master Container Form"

Jan 24, 2008

Hi there. I need a way to pass data between forms, and subforms. I have "form1" which simply contains a text box requiring the user to input an ID which I will call "PID". it also has a button which has the following code:

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[PID]=" & Me.PID
stDocName = "TestExam"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub

On the form testExam, I have a page control with 3 separate tabs. For each tab, I've embedded three separate subforms. All forms involved, including the container form (testExam) are bound to separate tables. All tables have one common field - PID
I'd like the user to only have to input the PID on one form, and have it trickle down to all subforms.

In the FOrm_Current sub of the testExam form, I have the following code:

Private Sub Form_Current()
[PID] = Forms!frmForm1.PID
End Sub

Using this code, I am able to pass the data from Form1 to testExam, have the PID on testExam filled in and on tab 2. But tab 1 will not populate automatically. I have no idea why. I don't know where to start troubleshooting this.
Please help.

Is this even a good way to pass data between subforms?

View 10 Replies View Related

Forms :: Forms With SubForms Opening With New Record?

Mar 8, 2013

I have a main form with multiple subforms in tab view, right now the forms only open in edit mode, I would like all forms to open to new record mode. I know I can set the main form with the switchboard manager but what about the subforms?

View 2 Replies View Related

Forms :: Show Tabs And Subforms In Tabs Only If Data Exists

May 6, 2013

I'm trying to clean up a form a bit and have it only show certain subforms/graphs if the data exists. I already have columns in a combobox query to show an "X" for if certain data appears:

Now, I know I could build another query and have some system go through and identify these things, but the easiest thing would be to reference the "X" in the columns of the combobox. Is there an easy way to reference values in the other (non-primary) columns? Or can you think of an easy way to make these subforms only be visible when the data exists? Maybe have an on load event for the subform?

View 2 Replies View Related

Forms :: How To Find What Data Is Actually Being Passed Between Forms And Subforms

Nov 22, 2013

I have several Suppliers, each of whom holds several SalesEvents. At each SalesEvent I might buy none, one or more Bundles. Each Bundle then contains one or more Items. These relationships are all reflected in my Access 2013 desktop db as one-many relationships with cascaded updates.

My form structure for data entry reflects the Relationships, in that I have a Supplier form with a SalesEvents subform. On that subform I can enter data about each of that Supplier's SalesEvents, and each SalesEvent row has a button to call up a SalesEvent form which has a Bundles subform. Then each row of that subform has a button which calls up a Bundle form containing an Items subform. That Bundle form identifies the Supplier, Sales Event and Bundle number, and within its Items subform I can then enter the data for each Item.

Problem : All used to work fine, but I've clearly changed something because now when I select the Items button on the Items subform in the Bundle form, the system gives me the data for the first record in the SalesEvents table, rather than the one selected. I have checked the raw data and that's as it should be. I have tried to undo all the steps I took since it last worked properly, but to no avail. Restoring the last backup (taken when I'm sure it worked properly) still has the problem.how do I find what data is actually being passed between forms and subforms ?

View 3 Replies View Related

Tables :: Auto Fill Values In New Record With Data From Previous Record

Apr 29, 2015

How to fill values in a new record with data from previous record?

I've total 11 columns in a table and values in 3 4 columns are repeating for few rows before it needs to be changed eventually. I want to fill these rows with values from previous record.

View 10 Replies View Related







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