Get Previous Field Value In A Query Without A Form

Aug 20, 2005

I have been looking at some of the solutions to the running sum problem.

The queries I use cannot use the primary key as there are gaps as some filtering has been done with an unmatched query to give me my sample dataset.

From this dataset I have a list of courses and the number of learning hours per each course. This is the field I would like to perform the running sum on.

Its a parameter query and the intention is to email the query the the various schools so no form was necessary.

The solution on microsofts web site wants me to use a form and I dont understand how it works anyway.

Is there a code solution that can use a recordset that doesnt rely on forms?

At present I am reliant on the date which does work but not where a student does two courses on the same day. The forums advice was to use the autonumber but there are gaps in that so that doesnt work. can I generate an autonumber on the fly as an expression and use that in the sub query method?
Fields:
[Date][Person Id][Course Code]
[Course Name][GLH][Running Total][UpliftCode]
[50%][Rule Broken]

what I have so far:

SELECT Pro.Date, Pro.[Person Id], Pro.[Course Code], Pro.[Course Name], Pro.GLH, (Select Sum(Pro1.[GLH]) FROM [QryAllEnrolmentsWithoutMatchingQryWithdrawls] Pro1 WHERE Pro1.[Date]<=Pro.[Date]) AS [Running Total], Pro.UpliftCode, [Running Total]/2 AS [50%], IIf([UpliftCode]="99","No",IIf([GLH]>[50%],"N","Y")) AS [Rule Broken]
FROM QryAllEnrolmentsWithoutMatchingQryWithdrawls AS Pro
ORDER BY Pro.Date;


kind regards in advance

View Replies


ADVERTISEMENT

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

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

Accessing Field From Previous Form

Dec 6, 2012

I'm working with a form (MainF) ... which has a subform (MainSubF). The subform has buttons that link you to other forms. When you click on one of those buttons, I have a control number that links the two forms by putting a CTR field into the linked form with a ctr defaul that = forms!mainf!ctr.

My problem is that I'd like to use this subform on other forms. However, if I put the subform onto another form such as "MainTwo", none of the buttons on the subform will work because the path is now wrong. Is there a generic way to connect the buttons to whatever form the subform is attached to??

View 6 Replies View Related

Auto Fill Form Field With Value From Previous Form

Jul 20, 2015

I've got one form that a user will start on, titled "Query Form" - Only one text box is here and it is titled "text0"

Upon hitting enter here, a new form is opened up titled "Time_IN_Form".

What I would like to do is have the value from text0 on the Query Form to automatically populate Emp_ID on Time_IN_Form so the user doesn't have to enter their employee number twice (only once via the first form).

What is the best way to do this? I have tried playing with global variables but didnt have any luck with that.

View 5 Replies View Related

Forms :: Using ID Value Passed To Form From Previous Form In Query

Aug 17, 2014

I have a big table, EquipmentDetails and separately I have job plans.Job plans can have many pieces of equipment. I store the relationship in EquipmentDetails_JobPlanDetails, but am feeling frustrated as I can't seem to get Access to build the SQL query from this in the way I want.

I am generating a List Box in a form which is populated from a query.The query calls on a table which lists ItemID from EquipmentDetails and JobID and in the current form (where the list box is) I want to pick up and display the ItemIDs associated with that JobID. The current JobID reaches my form correctly (I've proven this by displaying it in a text box) from the previous form.

The problem I have is that I can't seem to get the SQL query to only get ItemIDs that are linked to the current JobID. No matter what I try, it either gets all of the ones in that table, or I can't compose one.What kind of SQL do I need to only grab the ones relating to the current JobID please?I've tried building it in the design view but it says that it can't do it because the outer joins are ambiguous.

View 2 Replies View Related

Queries :: Average Calculated Field From A Previous Query - Crosstab Data Type Mismatch

Jun 3, 2014

I am trying to construct a crosstab that averages a calculated field from a previous query. It is returning a "Data Type Mismatch" message.

The field I am trying to average is a subtraction of dates to find total days. I assume my field is not a number so I have tried to wrap it in CDbl() to change the type.

The formula is

Code:
CASE_DAYS: CDbl(IIf([Actual Close Date]-[Creation Date]>=0,[Actual Close Date]-[Creation Date],""))

View 5 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

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 3 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

Default Value From Previous Entry Into Field

Apr 4, 2008

Hi,

I have a user who would like the value from the last entry into the form's title field text box to show as the default value when he clicks on enter new issue button to bring up a new record. I do not know if this is possible but I thought I would check for him.

View 14 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

Refer To Previous Calculated Field

Jan 17, 2007

Access 2003.
I was just wondering if there was any way to refer to a calculated field in the same query.
For example if the first calculated field was - Total: ([Quantity])*([Price]), could you add another calculated field - Inc Tax: ([Total])*1.175.
At present I am having to type the whole formula in the calculated field again which seems to work for some queries, but not for others, no matter how I fiddle about with the syntax. The other way is to create another query and refer to my previous query. Both these methods seem extremely cumbersome and I was wondering if I have missed something with referring to a prior calculated field.
The query above is just an example, my query formulas are actually fairly long and for editing purposes it can be difficult to correct them.

View 4 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

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

General :: How To Use A Previous Value Of A Field In A Table

Apr 22, 2014

I have a simple Table with the following structure:

ID
Product
Current_Level
Received
Available

How can I retrieve the previous value of the field [Available] and to set this value for the new [Current_Level] ???

View 7 Replies View Related

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

Saving Previous Unbound Field Values

Oct 5, 2005

hi

i have a form (A) with some unbound combo boxes which generate a subform (continuous) recordsource and the records output

after i filter the subform, i click on a subform record and open another form (B), and close form (A)

i do a bit of editing on form (B), then i click a button to go back to form (A).

is it possible to open the form (A), with the unbound combo boxes values at the same value as when form (A) was last closed, and as such the subform records output as per when the parent form (a) closed

if this is possible i can then have a button on form (B), to go to the next or previous record on the form (A) subform

apologies if this sounds confusing, many thanks in advance

View 1 Replies View Related

Date Field Limited To Previous Dates

Mar 17, 2006

Hi There,

I was wondering, in a form (to add records in the Table) with a date field, can I limit that field to only previous dates. This will reduce errors in the table, no future dates anymore.

Thanks in advance,

View 3 Replies View Related

Forms :: Copying Content Of Previous Field

Jan 26, 2014

I would like the text from the previous field Invoice_Contact copied into the field Invoice_Contact of each new record created. I think I can use CTRL ' - but would like it done automatically if possible.

Field location:
Form = PatientUpdate - Subform = F_Invoice - Field = Invoice_Contact

The form and subform are linked through: Pat_ID

The subform is based on the table called Invoice with Invoice_ID as the primary key.I tried several variations of this DLookup from examples I found on the web but the field comes out with "error" in it and its flashing!

View 14 Replies View Related

Forms :: Auto Populate Using Previous Field

Dec 16, 2013

I have a company that has a field for MailingAddress and PhysicalAddresses for shipping. When I enter the mailing address information I'd like the shipping to automatically populate with the information; however, I want to be able to change the physical address, if it differs. Is there a way I can do this without using a combo or list box? I tried changing the control source, which works, but I can't go in and make a change on the physical address without it re-populating the mailing address.

View 14 Replies View Related

Queries :: Sums Up All Previous Lines In A Field

Feb 9, 2014

I have a query that displays the difference between the number of scanned and processed invoices for each date (invoices scanned minus processed). Now I would like to make a query that for each date based on this shows the total backlog accumulated.

Example table:

The first column contains the date, and the second number of invoices scanned minus invoices processed.

2014-01-02 53
2014-01-03 -15
2014-01-04 24

Would it be possible somehow to make a query that for each lines shows the complete sum of all previous lines?

Based on the above data the result should be:

2014-01-02 53
2014-01-03 38
2014-01-04 62

Or would I have to write some VBA code to create some kind of temp table?

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 :: 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







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