This topic is locked

small wizard needed

3/12/2007 6:51:34 PM
ASPRunnerPro General questions
W
waynes author

I am trying to build a small "wizard" for some tables. That is, I have several tables linked to a master table and when I add a new record in the master table, I want the "save" button to redirect to a linked table to enter related data. For example, I have a master table called clients. When I add a new client, I need to add a booking for the client. After the booking, I then add a payment. Instead of going back to the master list each time, I want the save button to add the client then open the bookings page. When I add the booking, the save must open the payment page. How could I do this? All I guess I need is the key for the master record that is added, but how do I get this?

J
Jane 3/13/2007

Hi,
you can do it using events on the Events tab.

Save your masterkey in the Session("TableName_masterkey1") variable in the Before record updated event and redirect to the add page of another table in the After record added event. Use Redirect to another page action as a sample.

T
Tim 5/12/2008

Hi Jane,
Sorry to high-jack this old post, but this is exactly what I need to do! But I'm havin some problems. My master table is called Accounts and the detail table is called Payments. Here is the code I added to the After record added event of the Accounts table:
Session("dbo.Accounts_masterkey1") = dict("AccountID")
Response.Redirect "Class_A_Payment_add.asp"
It redirects fine, but on the add page of the payments table the AccountID field has "1" in it.
If I comment out the redirect and add:
response.write dict("AccountID") & "
"

response.write Session(strTableName &"_masterkey1")
It displays the correst data for both of these.
Any ideas?

Thanks for your time.

Tim

J
Jane 5/13/2008

Tim,
try to use this code:

Session("dbo.Payments_masterkey1") = dict("AccountID")

T
Tim 5/13/2008

Thanks Jane, but I'm still having problems. First, I lied: my details table is called Class A Payments (I was just trying to save some typing in the forum). So here is the code I tried this time:
Session("dbo.Class_A_Payments_masterkey1") = dict("AccountID")
I also tried:
Session("dbo.Class A Payments_masterkey1") = dict("AccountID")
But the AccountID field on the Class A Payments add page is empty now. The default for that field is Session(strTableName &"_masterkey1").
Also, now when I comment out the redirect and do:
response.write Session(strTableName &"_masterkey1")
I get nothing on screen.
Thanks,

Tim

J
Jane 5/13/2008

Tim,
it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

T
Tim 5/15/2008

Thanks Jane. I actually came up with another way to do this: I created a view for the payments table. This way I can use a different session variable as the default for the accountID. This worked well. It also allowed me to do some different things when adding a payment via this "wizard", as apposed to just adding a payment to an existing account.
Thanks again. The support for this product is amazing!... the best!

Tim