Jump to content

Add a new record - partially filled in

This topic is 6099 days old. Please don't post here. Open a new topic instead.

Recommended Posts

The duplicate record button almost does what I want to do. In my daily diary I have some fields which almost always are the same (like my location, how much I spent for another night in the hotel, and some others). I also have a date field which changes every day (what a concept!). What I want to do is create a button/script to add a new record with some of the fields already filled in and increment the date to the next day. Can someone get me started with this?

Link to comment
Share on other sites

Set your date field to an Auto Enter Calc Get(CurrentDate) or you can make it a "Creation Date." Either way when you create the record the current date will be there. You can also have Data entered into any field under Auto Enter and the in the Data box enter what you want. Just make sure you allow it to be overwritten under your validation criteria.


Link to comment
Share on other sites

I can think of two possible approaches.

One, create a set of global fields to hold the field values you want duplicated in the new record. In your script, do the following.

  • Set the global field values to the value of the existing record.
  • Create a new record.
  • Set the field values in the new record to the value of the global fields
  • Set the date field to the appropriate value.

The second is via a relationship. The setup is perhaps a bit more complex, but the duplication process is simpler, requires no global fields.

  • Create another instance of the table in the relationships graph.
  • Create a relationship between the tables based on the fields you want the values copied and the date.
  • Select the checkbox under the new table instance to "Allow creation of records in this table via this relationship."
  • In your layout, add a non-duplicated field for the new, related instance of the table.
  • By putting a value in that field, you will effectively create a new record with all the values defined in the relationship.

Your script could simply put a value in the field, then go to the related record using the same layout, then set the date (thus breaking the relationship.

Link to comment
Share on other sites

A much simpler approach would be to use aldipalo idea of auto enter of current date in the date field and auto enter "Value from last visited record" in the fields you want duplicated. Then simply creating a new record would do everything you want.

Link to comment
Share on other sites

This topic is 6099 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.