J
|
Jane 10/15/2008 |
Hi, str = "select max(FAULTREF) as FAULTREF_max from FAULTS" Set rstmp = server.CreateObject("ADODB.Recordset") rstmp.open str,dbConnection dict("FAULTREF") = rstmp(0) rstmp.close set rstmp=nothing
str = "select Location from MasterTableName where MasterKey=" & Session(strTableName & "_masterkey1") Set rstmp = server.CreateObject("ADODB.Recordset") rstmp.open str,dbConnection dict("Location") = rstmp("Location") rstmp.close set rstmp=nothing |
|
Stu author 10/15/2008 |
Jane, Hi, to calcualte new FAULTREF use Before record addedevent on the Events tab. Here is a sample code: To fill Location field with value from master table use following code: |
|
Stu author 10/15/2008 |
I am still stuck on the syntax reference to the Master Key that was used to open a Detail page and then to opened the Add Page. Jane, Thanks so much. I started to twig how to do this and so I used:- Set rs1 = Server.CreateObject("ADODB.Recordset") rs1.Open "SELECT MAX([Fault Number]) AS MaxF FROM dbo.[Fault Reports]", dbConnection session("NextKey")=rs1(0)+1 (Because I need to allocate the next highest free number) ___ That worked fine and I cheat in making my SQl statement by writing a View in SQL Server and doing a copy & paste into the code. Regards, Stu |
J
|
Jane 10/16/2008 |
Hi, |