This topic is locked

Auto Update Counter Record

2/27/2007 6:30:45 PM
ASPRunnerPro General questions
M
marcove author

Hi I need help to resolve a problem. I need to write in a field of the latest record added, the value of count (num. of records referred to the same company in table).
Here I copied code applied in AfterAdded Table Events, but it doesn't work.

Could you suggest why?

Thank you
dim ax

Sub AfterAdd()

'** Insert a record into another table ****

strSQLInsert = "SELECT Count(*) AS Espr1 FROM [PRO] WHERE ((([PRO].Azienda)="Company"));"

dbConnection.Execute strSQLInsert

strSQLInsert = "SELECT LAST(IDproIN) AS [highest] from [PRO];"

dbConnection.Execute strSQLInsert

ax=Espr1

strSQLInsert = "UPDATE [PRO] set IDProIN = ax;"

dbConnection.Execute strSQLInsert
End Sub

J
Jane 3/2/2007

Marcos,
there are some syntax errors in your event code. Try to use the sample events from the ASPRunnerPro Help.
Also I would recommend you to learn some SQL and ASP so you can implement this on your own:

http://www.webcheatsheet.com/asp/

http://www.w3schools.com/asp/default.asp
If you have difficulties writing event code you can post your table structure with detailed description of what you need to achieve and I'll help you.