Calculating Field Based On Value Of Another Field In Previous Record

Sep 18, 2014

I'm trying to create something like an online banking view that shows the running balance as each transaction occurs. I have tblTransactions with fields AccountNumber, ItemDescription, and TransactionAmount. I'm trying to create something that shows these three fields and a fourth field with the running balance.

So if I initially deposit $100 it will show the first record with TransactionAmount = $100 and RunningBalance = $100. Then the next transaction will subtract the Transactionamount for the new record from the RunningBalance from the previous record to get the RunningBalance for the new record. So if I make a purchase for $2, the AvailableBalance for that record is $98. Is this possible with a query? Here's a picture to describe what I'm talking about ....

View Replies


ADVERTISEMENT

Updating A Field Based On Previous Record

Apr 3, 2008

I'm trying to update an imported table from an excel spreadsheet with missing details. The table's records are in order so I just need to fill in a blank field with data based on the previous one as shown.


ID Name Location
1 Bob London
2 Larry
3 Harry
4 Jerry Glasgow
5 Paul
6 John Southampton


I need to fill in the location blanks simply with the last location details, so records 2 and 3 with London and 5 with Glasgow. Is this easily done or would I need to pull all the data into an array and work on it there?

I've tried searching for an answer but haven't had any luck.

View 1 Replies View Related

Dynamically Update Field Of A Current Record Based On Previous Record

Apr 30, 2007

I need a way to dynamically store a particular value in "field_2" of the CURRENT record depending on whether or not the value of "field_1" of the CURRENT record is identical to the value of "field_1" of the PREVIOUS record within the same table. The table is sorted on "field_1".

So, if the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is also "ABC", then store a value of "PPP" in "field_2" of the current record. IF on the other hand, the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is "XYZ", then store a value of "WWW" in "field_2" of the current record.

I have a report that will use these results to count only the number of records that have a "WWW" in "field_2".

Is this doable, maybe in a query somehow?

I should add that whatever the solution, it needs to be compatible with Access 2000.

View 1 Replies View Related

Forms :: Autofill Field Based On Related Field In Previous Form

Jun 30, 2015

I have my Assets form and the primary key is the ChargerID, in this form I have an "Add New Job For This Asset" button, which opens up the Jobs form at a new record.

How do I make it so that the ChargerID field is automatically filled with whatever the previous record was instead of being blank.

For example if I have Charger12345 open in the Asset form, I'd like to click the Add New Job button and it automatically have Charger12345 in the ChargerID field of the Jobs form.

View 5 Replies View Related

Autofill Field Based On Previous Value

Dec 27, 2005

I am trying to autofill a field based on the value of a previous field on a filtered form. I think the fact the records are filtered is throwing me off. Any help for me?

View 9 Replies View Related

Forms :: Available List Based On Previous Field Selection

Jul 6, 2013

I have a form whereby a user for my database can be created. The fields required are listed below:

Payroll ID
Forename
Surname
Location
Manager

The last two fields are related to two other tables; tblLocation and tblManager, which are related to one another.Each location (there are three) can have more than one manager, however, a manager can be associated with only one location.I would like whomever is creating the user to only be able to select a Manager that works at a particular location, currently, I can select LocationID 1 and ManagerID 3, but ManagerID 3 works at LocationID 2.

How can I base the 'Manager' field in my form on the previous field's selection, e.g. 'Location'.Also would need to restrict the order in which the form's fields are enter, i.e., 'Location' before 'Manager'.

View 13 Replies View Related

Auto-fill A Field Based On Previous Filed Within Same Column

Feb 9, 2012

How do I get access to auto fill a text (supplier)? I realize that for a new supplier I would have to input the supplier name, however my question is what should I do for Access to enable auto-fill so that the next time I have to input that supplier it would auto fill for me. This is happening in a single column.

For example: In the supplier column, I typed Dell in the first row, Apple in the second row, HP in the third row. Now when I start typing 'Apple' in the fourth row, I want it to autofill 'Apple' because I have already input that once.

View 7 Replies View Related

Field Value Same As Previous Record

May 23, 2006

When I click my command button that says, "New Record", I want it to go to go to a new record and populate the field "Town" with the value in the previous record.

e.g. ClientID on last record is 150 and has Town="London". Click "New Record". New record created. Town field on ClientID 151 has Town="London".

How can I do this?

Thanks,

Dave

View 3 Replies View Related

How To Retrieve Field From Previous Record?

Sep 8, 2006

Okay, here's the query as simplified as possible:



Month - Days - PreviousMonth



Month and Days are pulled from a table called Calendar. How do I get PreviousMonth to display the Month from the previous record?

I was looking at a ranking formula, and it seems like it compares the field to the previous one, but I am not sure how to apply it to my situation. The ranking formula I was looking at:

(Select Count(*) from Data Where [ProductA1] > [Data1].[ProductA1];)+1



Thanks in advance for the help.

View 3 Replies View Related

Copying One Field From The Previous Record

Mar 1, 2007

Is there a way to make a button on a form that when it is pushed it copies one field from the previous record and then the rest is blank?

View 1 Replies View Related

How Can I Configure A Table To Auto Data Entry Into Fields Based On A Previous Field

Aug 31, 2006

My situation is this. I have 3 tables that I have imported from my mainframe system, between these 3 tables I have the data of product code, description,supplier code, supplier name, order method, and ABC code.

I am trying to create another table that I can capture daily Out Of Stock data for products.

What I would like to do is to enter the product number in the first field of my new table, and then the remaining fields will auto populate with the correct details based on the product data stored in the parent tables that I have imported.

How can this be done?

View 3 Replies View Related

Forms :: Disabling Fields In Access Based On Data Entered In A Previous Field

Sep 9, 2013

How to disable fields in Access based on data entered in a previous field? For example if "yes" is chosen from a drop down show "Date field" if "no" is chose hide "Date Field".

View 2 Replies View Related

Calculated Field Utilising Data From Previous Record

Sep 14, 2004

Somebody please help me!!!

I am creating a database that will record the details of approx 30 shops and will store information on Annual Turnover, Profit, Return, etc.

I need to create a field that will calculate the increase/decrease in annual turnover between the current year and the previous year.

So far I have created a subform that will show the last 12 years of data for the particular shop, but now I need to add a calculated field that will get the current years turnover and also reference the turnover for the previous year, i.e. the previous record., and display the result. The other thing that I will need to do, is to have this field not calculated for the initial years trading, so this field will need to be hidden in the first record.

Can someone please offer some advice on how to go about achieving this???

View 1 Replies View Related

Having A Records Calculated Field Get Info From Previous Record

Jan 20, 2007

I have a table (tblStats). The user enters his current weight in a field named Wt. There are 2 other fields in the table named WkLoss and TTDLoss. These two fields are intended to be calculated. What I am trying to do is when the user enters his current weekly weight figure into the Wt field, I want the field WkLoss to get the user's weight from the previous record and place the difference in the field WkLoss. Also I would like to keep a total to date in the TTDLoss field.

So far this has been my attempt.
Code:Public Sub setWeight()Dim rs As DAO.RecordsetDim Startval As DoubleStartval = 190Set rs = CurrentDb.OpenRecordset("tblStats")'Select records to be updatedSet rs = CurrentDb.OpenRecordset _("SELECT * FROM tblStats ") rs.MoveFirst Do rs.Edit'field to update rs.Fields("WkLoss") = Startval rs.Update rs.MoveNext'increment step value Startval = WkLoss - Wt Loop Until rs.EOF rs.Close Set rs = Nothing End Sub
All I get is the value 190 placed in the first record and all zeros in the subsequent records. Also I don't have a clue as to how to get the Total To Date field to calculate.

Any help would be appreciated
Thanks for your time.

View 1 Replies View Related

Modules & VBA :: Copy / Paste Field From Previous Record

Jun 22, 2013

It is a continuous subform (Names: Form = ClientUpdate / Subform = ClientUpdateSub.

All of the data implicated here is direct and in the subform's query table including the button we want to program.

(This is my example but it wont stay in columns in this "post box" )

IDNo App _ID App_Freq App_Date GetDates Action_Date
22 18 56 21-Jun-13 BUTTON 14-Jun-13
21 19 56 16-Aug-13 BUTTON 9-Aug-13

*

The GetDates Command BUTTON should generate the red data above, like:

Private Sub GetDates_Click()

Go to a new record
Go to the field App_Freq and fill it with:
Copy/paste the data from the field of the same name in the previous record
Go to the field App_Date and fill it with:
data based on this calculation using the PREVIOUS record fields: App_Date + App_Freq (which are days)
Go to the field Action_Date and fill it with:
data based on this calculation: App_Date (of current record now filled out - step above), minus 7 (days).
End Sub

That's it!

All the dates format is set to medium date. An error message should come up in case App_Freq is empty, for example

Also note that the data can be manually changed at any time and should not revert to its last calculation. The button only generate data into a new record.

View 14 Replies View Related

Forms :: Copy Record From Previous Field If No Specific Combobox Value

Oct 30, 2013

I have an access form that needs filling in daily by various people.

It's to document changes to a website and I currently have a combobox box set up for the various sections to state whether they are AMENDS, REVERTS or NO CHANGE.

I have set conditional formatting to then highlight these sections but am also trying to get it to work so that if the user chooses "NO CHANGE" then the data for that field copies over from the previous record.

I have set this up in the AfterUpdate code for the combobox, but nothing is happening, not even an error....

Code:
Private Sub COMBOBOX1_AfterUpdate()
If Me.COMBOBOX1 = 3 Then
Me.[FIELD_TO_CHANGE] = DLookup("[FIELD_TO_CHANGE]", "tb_TABLE", "[ID]=Forms![form_FORM]![ID]-1")
End If
End Sub

(Where 3 is the value of NO CHANGE in the combobox, and FIELD_TO_CHANGE, tb_TABLE and form_FORM being the names of the various elements)...

View 1 Replies View Related

Value Of A Field Based Upon Value Of Another Field In The Same Record.

Nov 8, 2004

Hi,

My apologies in advance if this has been answered before.
Ok, Here is the question:
Is it possible to filter the values of a field (field 'y') based upon the value chosen in a previous field (field 'x') of the same record? Can this filtering occur within the table itself.
Values for fields 'x' and 'y' are taken from table 'ProductGroup' and 'Products', respectively.

liguor60

View 3 Replies View Related

Forms :: Can A Field Auto-fill From Previous Entry In Separate Field

Mar 21, 2013

I've just returned to work after kids and started managing a large Access database related to health, back-tracking over many years.

Currently in filling a form we physically enter:
Apples 2.2
red apple 2.4
red apple cut 2.45
Oranges 5.6
Cucumbers 8.5

Is it possible to get field 2 to automatically fill with a number code due to the text typed in field 1?

FWIW, I'm confident at more basic Access e.g making follow on default value = Dlast("field""table") type stuff but the more complex stuff I haven't touched since Uni over a decade ago and you will need to be gentle while I blow away the cobwebs

View 3 Replies View Related

Auto Increment A Number Based On Record Value From Previous Record

Nov 17, 2010

create a macro that automatically fills in the next invoice number in sequence",,I'm assuming this macro would look at the value of the previous record and add a one to itI don't want to use a AutoNumber field as I might need

(a) to modify value or
(b) need to skip numbers.

View 8 Replies View Related

Showing Field Dependent On Previous Field In A Form?

Oct 24, 2012

I have a table called welding, I want to create a user friendly form for input. The database ultimately wants to go on share point so I am building it in the web database option.

One of the fields is called location, if the location is 'Field' I want 10 more fields to appear for data entry such as weld reason, rail temperature etc . If the location is 'Depot' I want these fields to be hidden as they aren't relevant.how would I do this?

View 14 Replies View Related

Conditional Format Based On Previous And Current Record

Feb 4, 2005

I'm having trouble with a tricky conditional format in a continuous subform.

The criteria is based on field [GroupNo] when it changes (increases) which are always listed in numerical order.

Basically all I want to is for the text box colour to alterante (eg blue & yellow)when GroupNo changes value

So it would look something like this....

Group NoID (highlight colour)

1 (yellow)
1 (yellow)
1 (yellow)
2 (blue)
2 (blue)
2 (blue)
3 (yellow)
3 (yellow)
etc etc

btw, although values will always be in order they may not all be output, so it's not just case of odd, even, odd, even (that would be too easy!)

I can retrieve the Previous Record's GroupNo value (via a function) in another text box and compare current GroupNoID with this in the Format Expressions and manage to change the colour, but it won't sustain this new colour for the subsequent same GroupNos, obviously as the values have changed.

So how can I....

Change the colour when the value changes.
Keep this new colour until it the value changes (increases) again.

Many Thanks

View 14 Replies View Related

Modules & VBA :: Autofill Cell Based On Previous Record Value

Aug 26, 2014

I am trying to write some vba code to auto fill a cell's value based on the value of the cell in the previous record (In a datasheet form) i.e. if the value in record one was '1' and the down-arrow key was pressed then the value '2' should be entered into the new ext record

I have written some pseudo-code to show what I am trying to accomplish:

if keydown = down-arrow and current cell contents isnumeric then
Cval = current cell contents
if current record = last record then
create new record
move down 1 record
set cell value of new record to cval+1
else
move down 1 record
if cell value = null then set cell value of record to cval+1
end if
end if

View 14 Replies View Related

Forms :: Autoupdate Textbox Based On Previous Record

Jun 17, 2013

I am creating a database for an annual golf tournament. Part of this is to allocate players to play off together at certain times.

I have a form bound to a table called tblteeofftimes. This form has five fields (continuous form) - four of which are comboboxes whereby user selects each player for the record (who will play together). The other textbox has the tee off time. the first tee off time will be allocated by user eg 7:00 am.

My problem is I need to update each ensuing record with a new time slot at 7 minute intervals. Rather than have the user populate the form themselves I would prefer this be done authomatically as the user moves onto the next record.

View 12 Replies View Related

Calculated Field Based On The Value Of The Next Record

Nov 11, 2007

Hi,
I have a query that contains the results of repeated tests on a number of persons. The goal of treatment is to get those test results below 50. I need to find, for each person, the period of time (with a start and an end date) during which their test was below 50. The dataset looks like:

ID + LabID + LabDate + Result + Undet
----+------+-----------+-------+------
101 + 21 + 1/1/2000 + 780 + 0
101 + 21 + 2/2/2000 + 320 + 0
101 + 21 + 3/3/2000 + 50 + 1
101 + 21 + 4/4/2000 + 50 + 1
102 + 21 + 6/6/2005 + 1000 + 0
102 + 21 + 7/7/2005 + 900 + 0
102 + 21 + 8/8/2005 + 50 + 1
103 + 21 + 9/9/2005 + 50 + 1
103 + 22 + 9/30/2005 + 567 + 0

What I need is a query that produces the following:

ID + StartDate + EndDate
----+-----------+---------
101 + 3/3/2000 + 4/4/2000
102 + 8/8/2005 + 9/9/2005

I can also provide an attachment with more data, if that would help. Thanks in advance,

View 12 Replies View Related

Forms :: Display Data Based On Previous Record But Not All Fields

Jan 22, 2015

There is a form which the user fills in 8 fields and saves it. Once saved, a new record opens.

However, I want to modify the save button to save the previous record and display a new record with only a limited no of fields to display from previous record, say 4 fields display from previous record, and the user fills the remaining 4 and saves it. Thus, the save cmd should continue to display 4 fields from the previous record.Already tried below code for save button but it displays all data of previous record as it is, doesn't display blank space for combo.118 and text2

DoCmd.GoToRecord , , acNewRec
DoCmd.GoToRecord , , acPrevious
Combo118.Text = ""
text2.Text=""

View 1 Replies View Related

Queries :: How To Create Auto-grouping Based On Change In Previous Record

Jun 29, 2015

I have a column "CAT" each time that CAT switches between 0 and 1, I would like my query to auto-create a "grouping" and increment the group by 1. What I am looking for is the output as shown below.

ID CAT GROUP
67 0 1
68 0 1
69 0 1
70 1 2
71 1 2
72 0 3
73 0 3
74 0 3
75 0 3
76 1 4
77 1 4

View 6 Replies View Related







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