Editing Field Values That Get Summed Up - Resets Total Field
Apr 7, 2015
I have several fields that I fill in on a form and they all need to add up in the last field. The first way that I tried this worked good for the initial data entry on the form. However if I need to edit one of the fields in the form then it resets the TotalCost field and I have to enter all of the numbers again. Is there some way that I can make this work? Or is this an Access quirk I will have to live with?
I tried to do this two different ways.
Here is the code for the first method:
Option Compare Database
Dim C1 As Long 'For Total Cost
Dim C2 As Long 'For Total Cost
Dim C3 As Long 'For Total Cost
Dim C4 As Long 'For Total Cost
[Code] .....
This way works great the first time that I tried it, I had to re-enter info in all the fields if I wanted to change one.
Here is my second method:
Which didn't work, i received an error message:
"The expression After Update you entered as the event property setting produced the following error: Invalid outside procedure."
And then nothing changes.
Code:
Option Compare Database
Dim C1 As Long 'For Total Cost
Dim C2 As Long 'For Total Cost
Dim C3 As Long 'For Total Cost
Dim C4 As Long 'For Total Cost
[Code] ....
So I know this second method is incorrect.
View Replies
ADVERTISEMENT
Sep 2, 2014
This method use to work. I have a split database.
My usual method is to delete everything in my table, which does not need to be maintained, then I Compact and Repair and re-open the form and my ID is reset to 1. Now it just continues from the last number I used.
This ID field can and will blow up pretty fast, so resetting it would be useful.
View 1 Replies
View Related
Apr 6, 2006
Is there any way to edit the hyperlink field in my table, I'm thinking along the lines of an update query?
The database has thousands of records and the user has not typed any text into the 'Display Text' part of the hyperlink. This means that the stored hyperlink is double size because if no text is entered into the display text part then access uses the hyperlink string. This is a problem for me later on in the design.
I have tried a simple update query and this updates the display text as required but also loses the hyperlink itself, which I want to remain unchanged.
Any ideas?
View 1 Replies
View Related
Mar 28, 2006
Hey all,
I have come across a problem with my database that I would appreciate some help with.
I have added to an existing table by creating a query with calculated fields (calculated from fields in the original table).
However, a few values in the calculated fields result in "error" or are null, this is due to the values in the original fields.
I have been given default values to substitute in for these error values, but I have found that I am unable to "edit" cells in a calculated field. (i.e. just trying to type a value in, replacing the "error").
Does any body know how I could go about putting these values in?
Or is it just a case that as they are known (not calculated), then they have to be included in the original table?
If so, how would I go about getting the calculated and non-calculated values in the same field?
Any help will be appreciated,
Thanks all,
Matt. :confused:
View 10 Replies
View Related
Apr 27, 2005
I hope I can explain this:
I have a database with a table "Itinerary" it has two fields "Date of Visit" and "Agency Number"
I have a second table that is linked from a different database "Agent Info"
I created a form based on the "Itinerary" Table then I put in a sub form to show the "Agent Name" and "Market Rep" from the "Agent Info" table.
The relationship is on Agent number in both tables. The user then adds the agent number on the form and the Agent name and Market rep automatically come in.
The problem is the user wants to be able to occasionally modify the info in the Agent Name and Market Rep fields. But does not want the new info to be changed on the original "Agent Info" table.
Can this be done?
I hoep someone can help.
View 1 Replies
View Related
Jul 26, 2005
I have a button in a form that needs to change the text in a field named idStatus from "Assigned" to "Returned"
I have tried using an expression like this "[Form]![Field]=12" in the OnClick spot but it returned an error. There is no "custom made" wizard for this and my VB skills are lacking.
Once again, thanks! (I know I post alot but this forum is amazing!)
View 1 Replies
View Related
Mar 20, 2015
I need for Access only to sum the "hours worked" of my payroll data, only if another field, "pay code" meets a certain criteria.
In Payroll, some codes are used to designate actual hours worked like REG (Regular Hours) and like OTS (Overtime Straight) while other codes are added as "premiums" to these hours and do not mean that you actually worked those hours, like OTP and HOD (Overtime Premium & Holiday Premium). The hours are only added as a reference to the actual hours worked they are attached to. Their units should not be counted as hours worked.
I want Access to 1) Group By Cost Center, 2) Sum "Hours Paid" that are tied to a REG or OTS (only), but 3)Sum the Earnings for all pay types.
Basically, (in excel-like terms: Hours Paid Column= SUMIF of Paycode = REG OR OTS. But Earnings Amount Column= Sum of all Paycodes)
Cost Center
Job Type
Hours Paid
Pay Code
Earnings Amount
20530
Security Guard II
7.5
REG
190.37
[Code] .....
View 14 Replies
View Related
Jul 10, 2013
Not = " " And InStr(1,"seat_person"," ") <> 0
I have a field into which I wish to place a person's name and I want to ensure that the field has a space in it but is not a blank field,
so
all blank - illegal
"Bob" - Illegal
"Bob Smith" - legal
the edit at the top is my attempt to code it but it isn't working.
View 13 Replies
View Related
Nov 23, 2005
Hey all,
I have two fields 1 & 2
field 1 is a simple combo list of user defined values ie A, B, C or D
Field 2 relates to a attribute of the data in field 1 and is not always the same for A, B, C and D. i.e
A could have a,b,c,d or e
B could have c,e,f,g or h
C could have a,g,h,i or j
D could have v,w,x,y or z
I would field 2 to have a combo box which only displays a,b,c,d, or e when A is chosen in field 1; c,e,f,g or h when B is chosen; etc
How do I do this?
Cheers all,
Matt :confused:
View 2 Replies
View Related
Feb 16, 2014
I'm pretty good with setting up a very simple database such as inventory, profiles, etc.. However I'm creating a database to keep track of a football (soccer) team's players and match statistics.What I have so farsample attached)
Tables:
* Players - PlayerID, Fname, Lname, position, goals, assists, etc (all details regarding a player)
* Position - Positons (Table containing positions eg: defender. Data is selected in player's form as a combo-box)
* Competition - Competition types (Cup, League, Friendly. Data is selected in Match's form as a combo-box
* Venue - similar to Competition table
* Opponent - Similar to above two tables
* Match - MatchID, Competition, Venue, etc (form corresponding to table attached)
Forms:
* Player form
* Match form
Now as shown in the sample, I choose players using the combo-box. Then whatever stats they had during the match are entered on the fields provided. How to link the player (selected using combo box) to the stat fields (goals, assist, YC, etc).
View 1 Replies
View Related
Jul 25, 2014
i want to add a control in that form that sums up and aggregate all the values of field called [amount] based on the value of [Name_Patient] as criteria
View 2 Replies
View Related
Nov 18, 2014
I am trying to create a list of values in a field separated by commas. I have done this in a query as follows:
[Field1]&", "&[Field2]&", "&[Field3] and so on.
However, when Field2 is null, the result is two commas between Field1 and Field2, but I only need one. What function can I use to eliminate the extra commas when fields used in the concatenation are null?
View 10 Replies
View Related
Apr 24, 2013
Access 2013 stops working when I open any table in design mode, and select any field with the type "Number". I can edit Text, Date or Yes/No fields, but not Number ones.
View 7 Replies
View Related
Nov 10, 2005
If I have the following Code to disable a field based on the value of another field:
Private Sub lstAgreementType_AfterUpdate()
If Me.lstAgreementType.Value = "BN" Then
Me.txtSenateAandCDate.Enabled = False
Else
Me.txtSenateAandCDate.Enabled = True
End If
End Sub
But I also need it to disable the field is equal to "BA" or "BT" as well, how would I add that to my code?
View 3 Replies
View Related
Nov 17, 2006
This is what my query looks like at the moment:Field: Issue,Rejected,Inspected,AreaTotal: Group By,Sum,Sum,WhereCriteria:,,,[Area:]What I'd like to have is a calculated field after "Inspected" which would show the grand total of all "Inspected" for that "Area".Example:Issue, Rejected, Inspected, Total Inspected Scratched, 5, 100, 130Chipped, 1, 10, 130Dented, 2, 20, 130Any ideas on how to get the "Total Inspected" field?Thanks!
View 1 Replies
View Related
Sep 14, 2007
I have to count the number of records in a subform that meet certain criteria. I have a yes/no field and presently have a field in the subforms footer that =Count(*) and I would like to be able to count only the "Yes" records. Is there a way to use the count function to do this.
View 4 Replies
View Related
Jan 18, 2005
Hi all,
I'm fairly amateurish on Access so be gentle.
I need to ask Access to calculate a total number of records but only includes duplicate entries once.
For example: If the field entries were A, A, A, B, B, C, C, D
It would return a total of 4 (counting A, B, C & D only once).
Can anyone advise on how I can do this? My only alternative is to print the database out and cross out duplicates. Not the most interesting way to spend my afternoon.
Thanks!
Stu.
View 2 Replies
View Related
Oct 7, 2013
I have a Table which has a column that contains a Data (last day of the month: 8/31/2013, 9/30/2013) and also contains a Balance field.
What I am trying to accomplish is a query that will provide me with the total for the last month (Sept), and then also provide me with a Percent break down from a whole balance.
I have the following SQL for it:
SELECT ATB.FC, Sum(ATB.Bal) AS SumOfBal, (select sum([Bal]) from ATB) AS Total, Sum([Bal]/[Total]) AS [Percent]
FROM ATB
GROUP BY ATB.FC, ATB.MMDDYY
HAVING (((ATB.MMDDYY)=Date()-Day(Date())));
Right now, when I run the above, the Sum(ATB.Bal) pulls just the month of September, but the Percent is pulling a percentage of each Sept. Value against the whole Balance for the Year. So, when I sum the percent column to get a total of 100% for the month of September, I am ending up with a number less than 20%.
View 1 Replies
View Related
Oct 22, 2013
I've tried many things (compact and repair, Nz(,0), sum()) and I can't get it to work.
I entered =[field1]+[field2] but it behaves like if I had entered =[Field1] & [Field2].
Yes instead of adding the numbers it just puts them together.
For example: Field1=3 and Field2=5 instead of field3=8 it shows Field3=35.
View 3 Replies
View Related
Jan 5, 2006
I really need some help with this! I have a table with a field called [days.out]. It contains values from 1 to about 350, non sequencial with duplicates. I would like to run a query that would create a new field called [days.grouped]. This field would contain the word "1-15" if the value was between 1 and 15 in field [days.out] and "15-30" if value was between 15 and 30 in field [days.out], etc....
Hope someone can help me!!
View 1 Replies
View Related
Nov 22, 2013
I have several result fields which are all drop down lists. I want each result field's drop down list values to be different depending on the selected value of the Test1 drop down list.I came up with using the .rowsource keyword. My syntax seems to be fine but I'm not getting any values under the result fields when I run the form.Here is my code so far:
Private Sub Test1_AfterUpdate()
If Me.Test1 = "Stress Echo" Or Me.Test1 = "Stress SPECT" Or Me.Test1 = "Stress PET" Or Me.Test1 = "Stress MRI" Then
Me.Test1Result2.RowSourceType = "Value List"
Me.Test1Result3.RowSourceType = "Value List"
[code]...
View 14 Replies
View Related
Feb 17, 2006
I have a query, and I want a field that shows the current balance as of that transaction, eg:__________________________________________________ _______|__Transaction ID__|__Type_______|__Amount__|__Balance__||__1______________|__Deposit_____|__£10______|__£1 0_______||__2______________|__Deposit_____|__£30______|__£4 0_______||__3______________|__Withdrawal__|__£15______|__£2 5_______|So far, I have this:SELECT [Transaction ID], [Type], [Amount], (SELECT Sum([Amount]) FROM tblTransactions AS tblTransactions2 WHERE tblTransactions2.[Transaction ID] <= tblTransactions.[Transaction ID]) AS BalanceFROM tblTransactionsWHERE [Account ID]=1;Although this does not look at the 'Type' field; it just adds the amounts; regardless of it being a deposit or withdrawal. I'm really not sure how to add this.Thanks in advance.
View 11 Replies
View Related
Jan 11, 2007
Below is the sql code I have for a CrossTab Query. Total as GrandTotal
shows GrandTotal of all weekly columns. Is there anyway I can get the
Query Display to sort on the GrandTotal Column?
PARAMETERS [Forms]![Queries_ReportsFRM]![StartDateTxt] DateTime, [Forms]![Queries_ReportsFRM]![EndDateTxt] DateTime, [Forms]![Queries_ReportsFRM].[FaultCategory] Text ( 255 );
TRANSFORM Sum([Trends-1-3TON-WEEK].Totals) AS SumOfTotals1
SELECT [Trends-1-3TON-WEEK].SystemGroup, [Trends-1-3TON-WEEK].FaultCategory, Sum([Trends-1-3TON-WEEK].Totals) AS GrandTotal
FROM [Trends-1-3TON-WEEK]
GROUP BY [Trends-1-3TON-WEEK].SystemGroup, [Trends-1-3TON-WEEK].FaultCategory
ORDER BY Sum([Trends-1-3TON-WEEK].Totals)
PIVOT [Trends-1-3TON-WEEK].YearMonthWeek;
View 1 Replies
View Related
May 20, 2015
I have a table with dates in field1 and an amount of seconds in field2.
field1 field2
01/01/2015, 1345
02/01/2015, -132
04/01/2015, 259
I would like to produce a query that performs a running total in the third column like so:
field1 field2 field3
01/01/2015, 1345, 1345
02/01/2015, -132, 1213
04/01/2015, 259, 1472
This is quite simple to achieve in Excel. (eg =SUM($B$1:B3))
What is the query formula for Access?
View 1 Replies
View Related
Jun 24, 2013
I have qry with these fields: DateOfPayment and Ammount.
I would like to add another field with running total sum. I am trying this:
RunnTot: Format(DSum("[Ammount]";"qryCFSUM"; [DateOfPayment] <=#" & [DateOfPayment] & "#" );"0 000"" Kč""").
But It still does not work.
Example of my data in "qryCFSUM":
DateOfPayment
20.1.2013
31.1.2013
30.3.2013
Amount
1 2000 Kč
15 456 Kč
23 465 Kč
And what I would like to have:
RunnTot
1 200 Kč
16 656 Kč
40 121 Kč
View 14 Replies
View Related
Aug 5, 2013
i would like to sum up 5 fields and save (or just show it in the form view is enough really) in a seperate field, i have managed to sum the 5 fields, but it summed up all 5 fields in all records, i'd like to have my form show the sum for the record, not the table.
it would be ideal that it would refresh when one of the 5 fields data changes, i.e from 1000 to 2000. again updating in the form view is what is needed.
View 5 Replies
View Related