This topic is locked

Event: Add Record To Same Table?

3/18/2013 5:57:46 PM
ASPRunnerPro General questions
B
bussb author

Hello, I am creating a maintenance log table that I'd also like to include some scheduling features. The user will enter the record today with such information as:

ID

Date

Maintenance Description

Machine Number

Recurring? (Yes/No)

Frequency (Integer)
So today they replaced an o-ring on the machine, then they select Recurring="Yes" and Frequency=90 days, and click the Save button. I want to create a tickler record in the same table that is dated 90 days from Now(), with some of the same field values such as Machine_Number value pre-populated.
Is this possible using the events?

Sergey Kornilov admin 3/19/2013

Yes, this is possible. Use AfterAdd event and you can find sample code for adding a new record manually at http://xlinesoft.com/asprunnerpro/docs/add.htm
To add dates use DateAdd() function:

http://msdn.microsoft.com/en-us/library/cb7z8yf9(v=vs.84).aspx
Example:

dal.Table("MyTable").Value("Date") = NewDate = DateAdd("d", values("Frequency"), Now())