DLookUp To Divide A Field In One Record By The Same Field In Another Record

Dec 13, 2006

I'm fairly new to setting up Access databases. Been learning a lot. Ran into a snag that I'm hoping you can help me with.

I am using a form to display text labels and running statistics for our jail.

The form, "Complete_Worksheet" gets its data from a query, "qryComplete_Worksheet". Fields that make these up are:

ID (key)
Standard (text)
Outcome Measure (text)
Numerator/Denominator (text)
CalcValue (number)

ID, Standard, Outcome Measure, and Numerator/Denominator are queried from a table, "tblComplete_Worksheet". CalcValue comes from another query, "qryDataSelect". My problem is this:

In the final calculated statistic, some records are numerators and some are denominators. I need one more field, which I have been trying to create as a calculated control on my form which will divide each numerator CalcValue value by the denominator CalcValue value following it. Since these values change constantly as new data is entered into another data table, the calculated control needs to also change with them. I have been attempting to do this using the following expression:

=DLookUp("[CalcValue]","Complete_Worksheet", "[ID]="&"[ID]-1"/[ID]=")

I keep getting a #Error message in the control in form view. When I run the expression in the Immediate window, I get a Compile Error:

Expected: line number or label or statement or end of statement

Any suggestions on how to make this work?

View Replies


ADVERTISEMENT

General :: How To Divide 1 Record In Multiple Records

Nov 12, 2013

I have an order table

order nr quantity.
100 110

and a pack table

pack quantity
1 1
1 2
...
1 25
2 1...

I want to make a query that returns this :

order nr pack quantity
100 1 25
100 2 25
100 3 25
100 4 25
100 5 10

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

General :: Find Record From Field In Subform And Then Return Its Parent Record

Feb 6, 2014

I have a database which has a main form and subform built in linked by parent/child customerid, what i would like to do is search all the subform records from the whole DB and return its parent record on the main form?

Can this be done? because if i use find it will only search the filtered form i have onload of the form?

My onload event is based on fosusername()

View 3 Replies View Related

Queries :: How To Divide A Field Value By Its Sum

May 26, 2015

I have an alias named [Net Income]

[URL]...

I want to divide it's value by the sum of its values through another alias [%]. How to do it?

%:=[Net Income]/Sum([Net Income]) Not working

getting an error saying:

"You tried to execute a query that does not include the specified expression 'SR_NO' as part of an aggregate function."

View 4 Replies View Related

Forms :: Save Form Record On Move To Next Field In Record?

Jan 15, 2014

After I enter data into one field in a record I would like the form to save the record when I move to another field in the same record. It seems that the record is only saved when I exit it entirely. Is there a way to save a record when moving between fields in that record? Can this be done without using an Event Procedure for each field?

View 8 Replies View Related

Queries :: Can A Calculated Field Look At Record Before Current Record

May 1, 2013

I have a query to bring in values, I need to select 2 rows of data but the criteria is as such:

x= starting value on form

now the row of data must match the following criteria previous row to current row(ref temp)<=x And Current row(ref temp)>xnext row to current row(ref temp)>=x And Current row(ref temp)<x

I have dealt with SQL before but how to do the above.The isolated 2 rows of data will then go into unbound boxes on a form from which I will do intercept and gradient calculations.

View 5 Replies View Related

General :: Add Record To Table And Provide Field ID Value For New Record

Nov 16, 2014

I have the following script which updates fields in a table.What I am after is a msgbox script to list the ID field value once it is updated.

Code:
Set rec = dbs.OpenRecordset("Select * from Stk_Merge_Delete_Register")

rec.AddNew
rec("StkItemID") = [Forms]![MergeItem]![txtStkFrom]
rec("RackID") = [Forms]![MergeItem]![txtRackFrom]

[code]....

View 3 Replies View Related

Queries :: Put Sum Of All Records In Calculated Field And Divide It By Predefined Value

Feb 6, 2014

I want to take the sum of all records 'cost' i.e.
record 1 - 2
record 2 - 4
record 3 - 3

I want to take the sum and put it in a calculated field and use it to divide it by a predefined value 'no of responses.'

So I make the field in the query -> Calcfield: (Sum([cost])/[responses])

I am pretty new to this and i don't understand why this won't work? Is it something to do with the row Group by (total.)

View 3 Replies View Related

Forms :: Validating Text Field On Form Against Another Field In Same Record?

Apr 17, 2014

I have a form where I would like to validate (restrict) choices in subsequent fields.

Example

Combobox choices are Air, Fire, Water, Earth, Space

In the form I have 4 fields = Material1, Material2, Material3, Material4. (all in same record on my table)

Basically I need the validation to not allow duplicates across the 4 fields.

something like....

[Material1] <> [Material2] or [Material3]or [Material4]

I am not sure of the proper syntax for the validation field in the Form Properties. Or if I am even putting it in the right place.

View 3 Replies View Related

Forms :: Move From Last Field In Form To New Record Field On First Page

Aug 27, 2014

What is the best way to move from the last field on the last page of a form to a new record field on the first page?

View 5 Replies View Related

Rowsource Of Lookup Field Dependent On Field Value In Same Record In Subform

Jul 6, 2014

I want to create a different rowsource-query for a lookup field (field1) in each record in a subform. The rowsource changes dependent on the value in another field (field2) in the same record. How can this be done?

- I tried to change the rowsource-query in an eventmacro when the focus is set to field1, but this ofcourse changes the rowsource for all field1's and makes the allready selected values unvisible.
- I think I have to include the value of record 'field2' in the rowsource query, but i cannot find a way to include that value in the query.

Something like:

Lookup field1 in the subform contains this rowsource
- SELECT CUSTOMER.Id, CUSTOMER.AGE, CUSTOMER.NAME
FROM CUSTOMERS
WHERE (CUSTOMER.AGE= me![field2]);
me![field2] however does not function

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

Lock Field For A Record If Another Field Is Null

Nov 24, 2005

Lock field for a record if another field is null:

I would like to stop users from entering a date in "Ctrl Closed" unless they have populated "Ctrl Reason" for any given record.

Not sure how to do this.

Any ideas would be greatly appreciated.

View 6 Replies View Related

Default Field Value = Field Value In Prior Record

Jan 24, 2006

Hello. I am looking for a way to make a field value automatically default to
the value of the immediate prior field. For example, I am in record 11, and
in Field "City" I type "New York." When I create record 12, I want
City to automatically default to "New York." Is there a way to do this?

Thanks

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

Last Record Field

Mar 31, 2006

I would like to add a field to a query that has true for its value if the record is the last record in the query or false if the record is not the last record in the query. How would I do this?

View 5 Replies View Related

Dynamically Add Field To Record

Feb 24, 2005

This may be a really straightforward one but I cannot seem to find a solution.

I need to run a select query, (for a mailout) then mark the records that have been selected in the query on the main database table with a mailshot code.

Any ideas on how best to achieve this?

I was thinking of making the select query maketable (because I have to export a txt file of email addresses for a mailing list), then add a mailshot code field, then append this extra field to the main table.

The trouble is that I am not sure how to use the query to add this extra field to the maketable & once this has been done, how do I append the values to the original table when the mailshot code field does not exist, can it be dynamically created?

Any help will be much appreciated.

View 11 Replies View Related

Show Value Of A Field From The Following Record

Nov 10, 2006

I need to write a query that includes the values of 2 fields from the following record. e.g

index Name Total Name2 Total2
1 Dave 8 Steve 4
2 Steve 4 Mike 6
3 Mike 6 Pete 4
4 Pete 4

I can get a partial success when I use the DLOOKUP function along with a sequential indexed field but I am working with 10,000s of records and any subsequent query based on the results of this takes an absolute age to run.

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

Undo Record In Field

Jun 19, 2006

If quantity requird less than stock qty don't accept record by delete or undo the record . how to do it without deleting the table data ?

View 3 Replies View Related

On A New Record, What Is Value Of Text Field?

Dec 13, 2004

Hi all. Question: On a new record, what is the value of a text box prior to it being updated? I have tried to check and it is neither Null or Zero or "".

Basically, I have a text box on my form linked to a field on my table(the field is defined as number). In addition I have two check boxes also tied to their respective table.

I need to make the following happen:

Allow the form to close when
1) Both the text box and the check boxes are empty and/or unchecked. (on a new record)
2) The text box contains a numeric value and one of the check boxes is checked.

I can make the #2 work, but not #1. Any ideas, suggestions?
Thank you.

View 4 Replies View Related

Creation Of New Record When Tab Last Field

Sep 7, 2011

I have a subform with a lot of fields in which require input. I have set the tab order correctly so they go through in sequence. However, I have found when I tab out of the last field. Its creates a new record which I dont want.I want it to either return to the first field to just stop.

View 2 Replies View Related

Forms :: Dlookup Specific Record

Jul 8, 2015

I want to autofill in a text box with reference to a table I have in Access.I have the first text box that returns the first record in the table i want to get the data for with "text1 = Dlookup("numplate", "cars", "")

This returns the first record. I want the second text box to return the second number plate from the table.How can I get the second record to be returned...?

View 1 Replies View Related

Queries :: DLOOKUP To Look At Value For Previous Record

Sep 23, 2013

I have a table that will have ITEMID as unique field but location could have save values. I tried using DLOOKUP to look at the value for the previous record to see if I need that value is same as current, however, since my data query are text formats, I am unable to. I get a message of mismatch data type. apply my query to look at sorted table by Location and ITEMID and if previous location = location, then my area=0?

View 6 Replies View Related

Finding A Record To Add Data To A Field

Nov 27, 2006

Hi ,

I have developed a very basic contact DB to record enquiries coming into my business. The last field on the DB is for comments, so that anyone entering the DB can see the latest conversation we have had with a particular customer. What I want to do is create a means whereby I can find a customer within the DB and then be able to add the contents of our last conversation into the Comments field. Would there be any way of doing this via a switchboard???
I am a very inexperienced Access user so the simpler the answer the better. Many thanks in anticipation
Keith:(

View 2 Replies View Related







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