run a startup script to find date = Get(current date)
test for found count = 0 and create a new record and stamp current date if count = 0
set the status script to run on first open
this is under File> FileOptions > Script Triggers, on first window open.
(assuming you are using a recent FMP version)
count current date is the found count when finding date = Get(current date)
set a global field for display on the layout
may need a commit to force the display
OK: You want to start on the layout of one of your tables with a found set of 1 and this 1 record should be a new record just created for you now.
The advice by Cortical is nearly correct, but has two problems.
- If you are opening your database for the second time the same day it will still show some records if you or other people created new records earlier today.
- There is a good chance that you will end up creating a lot of empty records, unless you always and always and always open your database with the purpose of entering a new record. This is due to the fact that the script proposed by Cortical is creating a new record every time you start your database.
Consider one of the following solutions
A do as Cortical suggest, with two modifications
On open create one new record and then display just this record (thereby also omitting other records created today).
Create a script running when closing the last window ... deleting empty records in the database (thereby getting rid of all the records that was not used).
I do not like this approach with the creation of a lot of records that may or may not be used.
An alternative solution: A start layout
Create a startup layout with two buttons + keyboard shortcuts. Browse or Create New record. Thus letting the user choose what she want to do.
Thereby avoiding creating a lot of unused records.
Carsten and Cortical, I thank you both for your replies and I like both replies and or solutions. I will give it a shot, and see where it leads me.
the "we usually see" in your original post suggests that the solution is multi-user.
The "records created today" request, as you described it, is NOT taking into account the multi-user aspect.
Define exactly what should happen when n users open the database in the morning, then we can maybe come up with better quality answers.
siplus, you are correct....lol...just got a bit excited. but, yes, there will be only 2 users using the file as they are "auditors" or QAs (Quality Assurance) to make sure that what they had tested and checked either passes or fails.
Carsten's reply of: "If you are opening your database for the second time the same day it will still show some records if you or other people created new records earlier today" is perfectly fine as long as yesterday's date or previous dates are not shown.
As with Carsten's concern of "Create a script running when closing the last window ... deleting empty records in the database (thereby getting rid of all the records that was not used). I do not like this approach with the creation of a lot of records that may or may not be used " is also a concern of mine as well.