This topic is locked

Before record add event

5/2/2011 2:55:05 PM
ASPRunnerPro General questions
R
Raptor author

I have Asprunner setup when users all a document that it adds a records ( Note ) to a table called Notes. This notes table has a column called Noteid. I am wanting to have the field LeadingNoteid=Noteid.
'** Insert a record into another table ****

dal.Notes.PatientID=Session(strTableName & "_masterkey1")

dal.Notes.Note="Document added via Website"

dal.Notes.Date=[Date]

dal.Notes.Priority="Provider Note"

dal.Notes.Enteredby="System Generated Note"

dal.Notes.Followup=[Date]

dal.Notes.LeadingNoteID=[Notes.Noteid] or should it be dal.Notes.LeadingNoteID=value [Notes.Noteid]

dal.Notes.Add()
Can this be done

Sergey Kornilov admin 5/2/2011

I guess NoteID is an auto-generated primary key of Notes table. If yes, you are not able to find this value before record is added.
You need to do that following:

  1. Add the record to Notes table
  2. Find the NoteID of the record just added
  3. Update this record setting LeadingNoteID to the value of NoteID