Forms :: Sum Calculated Field From Subform Datasheet

Feb 8, 2014

I'm trying to sum a couple of columns from a subform datasheet and carry them onto the main form.

My main form, [frm_tours_details], holds subform [sbfTours] which is a datasheet.

On [sbfTours], I've got a couple calculated fields within the datasheet, one, called "txtStudentSum", which calculates number of people total ([students]+[adults]+[numfreeteachers]) and one, called "txtptotal", which calculates fee for the program based on the following formula:

Code:

=IIf([txtMonth]>=10 Or [txtMonth]<=4,([Students]+[Adults])*7,([Students]+[Adults])*8)

(The fee is $8/person in season, and $7/person out of season.)

I've been following online directions I found to put a text box in the form footer which then sums each of these calculated fields ("txtStudentSum" & "txtptotal"), and then reference these text boxes from my main form.

However, the main form text boxes just come up as #Name? or #Error when I try to reference these boxes on the subform. Or, sometimes, the one calculating total students will show the total of ALL students, adults in the database, not just those for this particular record-but only, it seems, if I have the subform open separately first, then load the main form. I also tried putting the whole original calculations into text boxes on the main form, but they will only reflect either the current record selected in the subform, or they will only show the first record, regardless of what you've selected, depending on which way I tried.

I've attached a copy of the database ... click on the tab 'tours', then click on, say, tour #6 (since this one is multiple programs and needs to calculate) to open the tour details form.

View Replies


ADVERTISEMENT

Forms :: Datasheet - Cannot Add Calculated Field

Jul 13, 2015

My form is a datasheet with 2 fields: "Product" and "Quantity". Obviously I can't add a calculated field in this type of form; however I would like the word " Total" to display in the "Quantity" field just under the last record. I would also like the sum of the "Quantity" field to display at the bottom of the "Quantity" field in the empty record below the last record.

View 14 Replies View Related

Forms :: Getting Sum Of Calculated Field In Subform Footer

Nov 9, 2014

I've got a subform (simple table view) inside a main form, the subform (sfrmRecipes) just has an IngID field (which stores ingredient ID's) and a percentage field

I've added a few calculated fields to this subform, to assist users in making decisions, however each of these fields needs a sum total

So far my percentage field (which is an actual stored field in tblRecipes) is the only one with a functioning sum
for some reason the two calculated fields (which are both plain numbers, no text) do not give me a sum total option, i am only able to use the count function on them

Why calculated fields dont sum up and if there is an easy way to get it working (tried creating my own text field in the footer and manually typing SUM(fieldname), but it does not work).

View 2 Replies View Related

Calculated Field In Table But Not In Datasheet

Feb 17, 2014

I did the calculated fields in my table but in my datasheet they are not appearing. Are they not supposed to show there? I have not created any forms yet.

View 1 Replies View Related

Forms :: How To Update Main Form From Calculated Field In Subform

Aug 21, 2013

I have a subform embedded in a main form, the subform has a field (text box) that is doing automatic calculation so no manual entries are needed from the user. I have tried to pass automatically the final result to a text box in the main form, but all events are not working (afterupdate, On change, On Dirty), etc.

I have a button to do the above mentioned in the main form, but I don’t want to use that button, I want to do all the process from the subform.

Also, from the subform I was able to do click on the button on the main form (programmatically), however MS Access is too quick and the value extracted from the subform is always empty (zero); Acees is finishing before the calculation is done.

I am using MS Access 2010.

View 4 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 :: Datasheet In Subform Won't Allow To Add A New Record

May 15, 2013

I have been handed an Access database (Access 2002-2003 file format) to clean up and update as necessary. Currently I am trying to add new rows to a datasheet that is in a subform. I have had no trouble in the past adding rows and for some reason now I can't.

In some instances I can update an existing row but never add a new one. Also, the records options are greyed out in the ribbon except for a select few that are not useful (refresh all, totals, more). Can't add new record from their either. I am in the main form that contins the subform which contains the datasheet, in form view.

View 5 Replies View Related

Forms :: Subform With Datasheet View

Oct 31, 2014

I have recently added a subform to a form and wish to display the subform in Datasheet view. Whilst I can get the proper data and headings to display, I cannot figure out how to get the column widths to persist. I can adjust the column widths while in (main) form view right on the subfirm columns themselves but after I save and reload the main & subform form, the widths revert to some sort of default value.

I have also tried adjusting the columns in the subform's associated data table itself as well as adjusting the text box widths when the subform is displayed in Form view but it does not affect the column widths when the subform displays Datasheet view.

What is more annoying is that I have another subform in which I was able to make the Datasheet view column widths persist but I don't seem to be able to properly recall how I did it.

View 2 Replies View Related

Forms :: Sum Function In Datasheet Subform

Oct 3, 2014

Sum Function in Unbound text on Datasheet subform..How to make a sum formula without count orange color rows Amount. Because that orange color rows is product return items so no need to count in SubtotalRs. Actually I have used below normal sum formula so it is ok but need to change the formula. how to give a formula without count orange Amounts?

View 1 Replies View Related

General :: Calculated Field In Subform?

Nov 14, 2013

I have an invoice form named frmInvoice. It contains a subform named subInvDetails. I am trying unsuccessfully to transfer a calculated subtotal from a text box in subInvDetails to a total in a text box in frmInvoice. Is there a way to do this? I have tried everything I can think of but I can't seem to make it happen.

To be more precise, I have a textbox which is a calculated value ([Rate]*[Hours]) named txtSubTotal in the sub form. In the main form I have a field named txtTotal. I thought that setting the Default Value of txtTotal to =Sum([Forms]![subInvDetail]![Subtotal]) was the right way to it, but the value of txtTotal remained zero. I have also tried using =Sum([Forms]![subInvDetail]![Subtotal]) as txtTotal's Control Source, but that didn't fit my needs or seem like the right way to do it. It didn't work anyway.

View 3 Replies View Related

Modules & VBA :: Reference Field On Datasheet - Unbound Subform Controls

Jun 2, 2014

I have placed an unbound subform on a form. I have the following code which loads in different datasheet to the subform:

'Loads in NewQuery
Me.data.SourceObject = "query.NewQuery"

'Loads in NewQuery2
Me.data.SourceObject = "query.NewQuery2"

etc.... this works fine to show these queries but i want to know how to reference the fields on the datasheet.

for example one of the fields in NewQuery is "ID"... When clicked i want to run code... normally on bound subform i could go for example ID_Click()... msgbox(me.ID)

how can i reference these other fields on unbound???

View 3 Replies View Related

Forms :: Grand Total Of Subform Datasheet

May 6, 2014

After having no luck with the standard datasheet E-Totals, i'm now trying to have a textbox on the main form that totals a subforms column called lineTotal.Line Total is a calculated query field that works out the Qty*cost.So say if they put in 5 lines on the subform, the textbox field will sum all of there linetotal and shows a rolling grand total.

View 10 Replies View Related

Forms :: Obtain Record Value From Datasheet Subform

Dec 23, 2013

How can I obtain the value of a record from my subform in datasheet view?

Ideally I could double click in the "cell", for lack of a better word, and grab that value to pass through to another function.

On double click event? What then?

Edit: I suppose the user could select the row that the value is in as well. As long as I could then find the field I need from within the row. That might make things easier.

Edit 2: Sometimes I post before doing proper research. I've figured it out. Here is a quick example. The below code references an unbound subform called "Main_AU" where the field I want is "Description". The MsgBox is used to confirm that the code is grabbing what I want it to.

Code:
Dim test As String
test = Main_AU!Description
MsgBox test

View 3 Replies View Related

Forms :: Display Subform As Datasheet And Allow Filtering

Feb 9, 2015

I am using Access 2010. I have a subform(continuous form) that I display as a datasheet and allow filtering. I display the record count by using Me.Recordset.RecordCount in the subform's form_current event. This value updates properly based on the column filtering except when the filtering displays 0 records.

When there are 0 records, the form_current event does not fire and I cannot figure out how to trap when this occurs so that I can display '0 records found'. How I can tell when the column filtering causes 0 records to display in the datasheet? Is there an event that fires when the user filters using the column headings arrow?

View 5 Replies View Related

Forms :: Counting Occurrences Of A Value In Datasheet Subform

Feb 7, 2014

I have subform (datasheet) with a column for gender indicating "Male" or "Female" I wish to place the totals for each gender (and total overall) on the main form footer. I have tried objects of every type with calculated controls using conditional count formulas such as

=Count(IIf([Gender]="Male",0))

But I get #error on everything.

View 12 Replies View Related

Forms :: Updating Subform In Datasheet / Continuous View?

May 1, 2014

I m having a subform in datasheet view. whn i use a join query as the record source for the sub form, i am not able to add or update any record in the datasheet. Is there anyway to use a linked query as record source of the datasheet with editable property.

View 2 Replies View Related

Forms :: Cascading Combo Box In Same Datasheet View / Subform

Oct 10, 2014

Is there anyway that we can do cascading combobox in the same datasheet view of subform? Basically I'd like to filter "Account Name" based on "Plan#" selected in the same record of subform.

View 3 Replies View Related

Forms :: Column Order In Subform Datasheet View

Nov 22, 2014

I have a subform in which I display a table in Datasheet View. The problem is, I cannot figure out how to place the columns in the order (i.e. from left to right) I want.

For some reason, right-clicking on a column header in Form View and selecting Freeze Fields will shift that column to the left but I can find no consistent pattern to it and no other way of shifting a column. Reordering the columns in the table itself seems to have no effect on the order they appear on the subform and moving the controls around in the subform in Design View also seems to have no effect.

View 9 Replies View Related

Forms :: Subform Datasheet To Populate Main Table

May 19, 2014

I have a subform that is essentially a blank table which users can create rows depending on how many they require and fill the table in.

I then want to be able to append a main table with the records that have just been created in the subform's table... but here is where an issue lies.

Main Table has 6 columns... subform table has 5.

I already have the value to put into the 6th column but Im just not sure how to do it... the value is obtained from the original form.

For each record, copy that record into the main table + adding another value into the extra column.

Is this possible? or doable?

View 4 Replies View Related

Forms :: Apply Filter To A Datasheet Subform Using Combo Box

Dec 9, 2013

I am trying to apply a filter to a datasheet subform using a combo box.

This is the code I have used on the "after update" event:

[Ordering - Price list items].Form.Filter = "[Secondary Category]=" & Combo72.Column(1)
[Ordering - Price list items].Form.FilterOn = True

When I run the query i get the following error:

Runtime error 3021:
No current record

I am not sure why it isn't working as this is how I have set up other combo box filters and it worked fine.

View 6 Replies View Related

Forms :: Eliminating Header Line In Datasheet Subform

Aug 10, 2014

With a particular client, they want to display a subform in datasheet mode. They do not want an alternative like continuous forms. If I am displaying the subform in datasheet mode, is there any way to eliminate the header row which contains the names of the columns in the subform? I know how to remove the captions themselves but the header row is still there. I don't think it can be done but I wanted to check here with those more familiar with this.

View 6 Replies View Related

Forms :: Subform Datasheet With Changing Query Crashes

Aug 8, 2014

I have a table of events, tblActivitiesDates which have an activity type and a date.I have a form which has a datasheet with a query source (a separate datasheet form embedded in this one), and 2 radio buttons. The query that is used uses radio buttons this way:

-Activity Type Filter: A radio button, that when clicked a combo box appears, with a list of activity types to choose from. Basically, filtering by Activity Type.
-Date Type Filter: A radio button, that when clicked 2 text boxes appear, in which you write the dates between which you want to see the events organized in the table. Basically filtering by dates.

To make reading easier, Activity Type Filter=ATF, Data Type Filter=DTF.There are 4 possible options:

-ATF=ON and DTF=ON
-ATF=ON and DTF=OFF
-ATF=OFF and DTF=ON
-ATF=OFF and DTF=OFF.

For each option, I have written a line of code in the appropriate OnChange/AfterUpdate/Whatnot events in the form: CurrentDb. QueryDef ("qry ActivitiesDates"). SQL = "SELECT..."according to whatever option is currently active.

When I enter values into the form, and instead of embedding my datasheet form I simply open it every time from the navigation pane in a new window, the datasheet is filled appropriately and works 100%. Of course, I have to reopen it every time I change something so the query will rerun.After the table crashes (will be explained soon), I re-embed it to the form before trying it again. The first time I re-embed, no matter what I do, the query doesn't update nor crash.

Say I start with the option ATF=ON, DTF=OFF, it will work fine, updating when needed, but if I tick DTF=ON, regardless of the dates I enter, the table will only change according to the first option (While when open in a new window will show the correct table entries), ignoring the fact that the QueryDef. Sql has changed. Once I tick ATF=OFF, the table crashes and I get the error:"Run-time error'3420': Object invalid or no longer set".The exact same thing happens when I go DTF=ON,ATF=OFF. It ignores the event types I enter, and once I tick DTF=OFF, it crashes with the exact same error.

I added Me.Activities_DS.Form.Requery (datasheet's name is Activities_DS) in every place it should update.

View 8 Replies View Related

Forms :: Subform Datasheet Record Selected Display

Dec 2, 2014

In Access 2010, if you have a form with a subform in datasheet view, and you move the focus away from the subform, how can you tell which record(s) on the subform are selected?

When the subform has the focus, the selected row is shown with a blue/grey tint. But as soon as the subform loses the focus, this disappears and all rows look identical.

Its an issue as I have 2 datasheet subforms on my main form, with the 2nd showing records related to the record selected in the 1st. But as soon as the 2nd subform receives the focus, it is impossible to see which record in subform 1 was selected.

I have tried conditional formatting, but that does not work.

View 1 Replies View Related

Forms :: Design Changes Not Reflected In Subform Datasheet View

Aug 15, 2013

I have a subform whose design I am trying to change. When I make changes such as moving fields or adding fields the changes appear in form view (and layout view), but not in datasheet view. However, if I delete fields, the changes appear in both form and datasheet view.

This situation results in behavior where I can have the subform open in design view and toggle back and forth between design and datasheet view, and they are different. However, toggling between design and form view shows the changes as having taken effect.

View 7 Replies View Related

Forms :: Sales Invoice - Updating Many Records In Datasheet Subform

Jul 4, 2013

I am trying to build a sales invoice for a pharmacy that contains a sub form in a datasheet view. The main form contains only the invoice number and date while the sub form contains the drug code, drug name, Qty., Available Qty. and Updated Qty.

Presently, I can only code the update to takes place on each line of the datasheet. I want the update to take place at the end when I must have finished inputting all drugs bought with same invoice number.

View 4 Replies View Related

Forms :: Datasheet Subform Not Updating From Main Form Add Record?

Jun 23, 2015

I have a navigation tab with 6 sections, of the 6, 5 of them are self-made split view with a form view on top and datasheet on bottom and upon adding records through a command button on form view I would like the datasheets to update.

On other forms it would (I believe) update to the bottom of the datasheet, now on the ones I've been banging my head against it either replaces the top record or doesn't show up unless I switch tabs and switch back. From my searches I assume this is in need of a requery...

View 14 Replies View Related







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