This topic is locked

Autopopulate Table

12/25/2006 11:24:36 AM
ASPRunnerPro General questions
P
Philip author

I managed to autopopulate a table from another table (Event Add page / on load), but it works not always.
My code:
[indent]Sub AddOnLoad()

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

str = "select * from masterdata where H_Lizenz_AOA=" & Session("UserID")

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
Session("H_Kategorie_AOA") = rsTemp("H_Kategorie_AOA")

Session("H_Klasse_AOA") = rsTemp("H_Klasse_AOA")

Session("H_Name_AOA") = rsTemp("H_Name_AOA")
End Sub[/indent]
Problem: in 90% of cases when I click the add link the window opens but with empty fields. I click the refresh and fields are populated. What can I do to have it populated in 100% of cases?
Philip

Sergey Kornilov admin 12/26/2006

Philip,
AddOnLoad event happens after controls are populated. You cannot use this event to assign default values.
Use AfterSuccessfullLogin event for that purpose.