here is also a simple demo and may not reflect with the record on your database.
open MainForm and select from the combobox.
//Edit: I change the code to always show the 16 subform.
the original database (which is Edge-based webbrowser) can be found here:
https://www.access-programmers.co.uk/forums/threads/calendar-that-works-in-the-edge-browser.335252/
the code is not mine and attribution goes to Mr.Doozer of the above thread.
also the New code for old IE-webbrowser...
that is the catch, c&r, purge deleted records and reset the table, so Last() will not be reliable.
it also resets all queries execution plan, i think.
but i don't always use c&r, it might do harm than good, specially if power interruption occurs.
i don't know why are comparing excel against access.
just prove that Last("FieldName") is not returning the "Last saved New record".
you can also create a query from the table, sort it Asc or Desc (if you want).
then on vba->immediate window:
?DLast("FieldName", "YourQuery")
if you acquire something, say a house, or a car, i am sure you get the "house plan" or the car manual.
it include the technical manuals.
you don't acquire and update (as ms does with mso) it blindly.
i am sure you have those "field manuals", "parts manual" "tech manuals" while you are on the navy.
test it first. add a record one by one.
Create a query that uses Last("yourFieldName") against your table and save the query (qryLast).
run the query and note the result.
edit any record (not the record qryLast has shown).
then run/refresh the query and you will get same result.
do any edits on...
For the sake of argument, supposed your table does not have autonumber field or any numeric field.
what you have is FirstName and LastName (all short text) fields only.
How then will you know which is the Last record entered without using Last() in SQL?
Last() would have been stripped by MS if...
or something lik this:
If Val(sStr) > 0 Then
rs.FindFirst sField & "= " & sStr 'This works with a numeric input
Else
rs.FindFirst sField & "= '" & sStr & "'" 'This works if the input is the same as the field value.
sStr = "'*" & sStr & "*'"
If...
Last() will return the Last record you added, While Max() will return the Biggest value in a Field.
suggest you add a TimeStamp field to your table that whenever you Add New, this field is Updated to
the current Date/Time.
then you will only need to Lookup the Max() of this field to retrieve the...
i think the new msgbox coloring/bolding can only be done on form events directly "Expression" on the Event of the form.
like in the case of your Current Event and On Close event:
=Msgbox()
that way Access will Evaluate the expression, same as using Eval("Msgbox()")
you can't produce it using...