Last Record Field
Mar 31, 2006I 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 RepliesI 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 RepliesI'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?
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.
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()
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 RelatedI 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.
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]....
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.
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 RelatedI 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
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 ....
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.
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
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
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.
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.
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
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 RelatedHi 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.
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 RelatedHi ,
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:(
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.
Im using the UPDATE Query in Access
UPDATE MAT_Clean SET FCODE = 'BC', NOTES = 'HC RAMP'
WHERE FCODE='BC HC RAMP';
Instead of typing what needs to go into NOTES everytime, how can I specify whatever comes after 'BC' to go into NOTES? Use 'BC *'?
Thanks!
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,
Hello,
I have the following code for changing the back-color of a field:
Private Sub txttekst1_AfterUpdate()
Dim lngRed As Long
Dim lngGreen As Long
lngGreen = RGB(0, 255, 0)
lngRed = RGB(255, 0, 0)
If Me.txttekst1 < 100 Then
Me.txttekst1.BackColor = lngRed
ElseIf Me.txttekst1 > 200 Then
Me.txttekst1.BackColor = lngGreen
End If
End Sub
Problem: When I change to record to record the back color is not
the same as I have write the code.
mulderm
Hi guys, I need a little help on next record stuff...:eek:
Can someone please explain how I can make my database actually go to the "Next" record after I update the "LName" field on my form? My database is sorted on "LName". After I update the "LName" field and save the record, the sort order is messed up. If I requery the form in the sub routine, the database goes to the first record. I need it to go to the "Next" record (the one that would have actually come next before I changed the LName). For example, if my database contains these names:
Baker
Doe
Franklin
Goodwin
Johnson
Jones
Smith
Taylor
and I change the current record's LName from Franklin to Phranklin, I expect the database to go to Goodwin (the record that would have followed Franklin) after pressing my next record command button. Likewise, if I changed Phranklin to Franklin, I expect the database to go to Smith (the record that would have followed Phranklin) after pressing my next record command button.
I've tried different versions of FINDFIRST on this site, but can't get it to work. I would like to find the next record based on my key field (autonumber) named "rec_id".
Thanks, and luv ya in advance!
-carol
http://profiles.yahoo.com/c_coop2005;)