Is there an opposite function in Archer for MostRecentValue? I wanted to get the very first record in a Related Records Field in a calculated text field. What should I use?
No there isn't a built-in function for this... e.g. OldValue(). But, here's something that should work:
Copy and save the first related record, when it is created:
Create a simple text field (not a calculated field) for storing the first record. Call it something like "FirstDate"
Create an Action that is triggered whenever the Related Record Field (the one you care about)'s value changes:
The action should check to see if the FirstDate field is EMPTY.
If it IS empty, then the action should set it to the value in the Related Record Field
If it IS NOT empty, it should end and do nothing
You can then always retrieve the first "earliest" record from the FirstDate field.
Related
Edited:
Let me try to explain more clearly. I wrote the earlier message in haste:
I have a sub-summary part which is sorted by the parent table's ID field. In this part, i have placed a summary field from the child table ( on which the layout is based ). This summary field is a running total of a number field in the child table , with restart checked. When this field is placed in the sub-summary part, it summarizes the values of all the records below it. Which is fine. What i want is to show that summarized value in each of the records just below the sub-summary. So for instance if the summary field shows a total of 1,000, then i want to show that 1,000 in each child record below in the layout. Then when the next break occurs and the field summarizes the next set of child records in the sub-summary I also want it to show the same value in the next set of records below it. I hope it's a little more clear.
It's difficult to understand what your question is. Some statements do not make sense at all. A sub-summary part is based on a field, not on a table. And a summary field is not "sorted".
If you want to show a running total in the body, without restarting at each break, you must define your summary field so. A summary field does not have to restart in order to show sub-summary values when placed in a sub-summary part.
Added:
A summary field displays the sub-summary value only when it's placed in a sub-summary part. If you want to show the same value elsewhere - or use it in a calculation, you must use the GetSummary() function.
Note that the GetSummary() function will only work if the break field is a local field. If you're grouping by parent, make sure you're using the foreign key field in the child table - not the primary key field in the parent table.
I would like to have a complete copy of a Record Permission field.
For example - I have a field "OWNER" which is Record Permission type.
I want to create another field called "OWNER_COPY" which will always include the value which was selected in the OWNER field.
I thought of few ways to do so but none succeeded:
Crete a new Record Permission field (OWNER_COPY) but it has no option to be calculated (it doesn't have the option: "Set the value of this field using....")
Create calculated Text field (OWNER_COPY)- but if I'm writing [OWNER] in the formula it will provide the ID of the value and not its name.(e.g. if the owner was "Oliver", I will get his id - "123"" in the "OWNER_COPY" field).
Crete regular Text field (OWNER_COPY) and add a rule. but I couldn't find any kind of rule which can fit this case.
Any suggestions?? Thanks in advance :)
Archer can't copy value of RP to anther RP.
I used a custom object for this purpose. The limitation is that the field will be populated only when end user actually interact with a form. The good thing is that the field will be populated instantly.
As an alternative you can use a data feed as Tanveer described above, but in this case there will be a delay between the time when you save the record and population of the 2nd RP field.
In Access VBA, is it possible to find the most recently edited row (Record) in a table?
Example below would be ID 3 as the most recently edited row
Since you are using Access 2010 you can use a Before Change data macro to automatically update a Date/Time field in your table. For example, if you add a Date/Time field named [LastUpdated] then the following macro will update that field whenever a record is inserted or updated:
The advantage of this approach is that it takes place at the table level so the [LastUpdated] field is updated regardless of how the record is inserted or modified. (That is, you don't need to rely on form code to update the field.)
You can add a time stamp field to your table and create a form based on the table. When shown as a table, the form will give you the same functionality as the table itself, but you will be able to set an event AfterUpdate The event can then (over)write the time stamp for that record. You can hide the time stamp control on the form if you like, or set Enabled=False
I would like to create an control on embedded on a continuous form of which its activation event creates a new record on the form and inserts today's date in the date field. I was thinking to use an SQL query to create the record but still am having difficulty.
Maybe you should try this...
In the table being inserted into, add a field called "date_entered" and have its default
value set to "Now()". This will give you a timestamp (knowledge of when the record was entered).
Doing it this way is the easiest way, and then you don't have to write any extra code.
What I have here is a table with some text fields. I basically put in the name of some students into a table. I got their info from forms that teachers had sent me. When I put their names into the database, I just put the names in based on which form was at the top. Does access track the actual time that a field was put in in such a way that I could sort my text fields by that so that when I give a list of what I just did to someone else, they won't have to sort through the stack of papers to make sure all of the papers are there?
I should add that I need to track this for an individual field, not just for the record. For instance, let me take this one piece of paper I have. When I get it from an outside agency, I then put it into the database with the student's name and some info. I then need to send it to the teachers for them to sign and send back to me. I am on the second part so the record had already been created, but I want to find the date that I entered the Date_signed field basically.
In this example, you set the default value of the dtmEntered field to Now()
p.s. Same answer as HugoLemos but with a pic :)
You can use a Date/Time field with its default value = Now() to store the time each record is created, as already suggested. That approach works fine when only one user can be adding new records, which sounds like your situation.
If you wish to also store the time an existing record is changed, you can do that from a form's before update event.
This example assumes a text box named txtLast_change which is bound to a Date/Time field in the form's record source. The text box does not have to be visible to the user for this to work.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.txtLast_change = Now()
End Sub
Create a field with a date type and set default value to Now()
As you have discovered, there isn't any way after-the-fact to know when data was entered in to your table, as it's not something that you captured in the first place. As you mentioned in one of your comments, you can determine the order in which you entered new records based on the Id, but knowing when additional data was entered would require more tracking fields.
In the future, you may want to think about a table design along these lines:
Column Name Column Description
ID Record Id
STUDENT_ID Student Id Number
STUDENT_FIRST_NAME Student First Name
STUDENT_LAST_NAME Student Last Name
... Other student info ...
DATE_ENTERED Date/Time entered
DATE_SENT Date/Time sent to teacher
DATE_SIGNED Date/Time signed by teacher
UPDATED_DATE Date/Time record last updated
UPDATED_BY User that made the last update
If it's possible, you could always edit your table and add these datestamp columns. You'd have to allow for null values, as the previous entries wouldn't have a date/time value for some of them, but it would let you track future entries.