CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 [RESOLVED]Insert new record, then immediately go to record for edit/print

Print topic Send  topic

Author Message
Chris__T


Posts: 339
Posted: 02/24/2010, 6:52 AM

Hi all,

Similar problem to this thread: http://forums.codecharge.com/posts.php?post_id=102802

I'm adding a record. Then when I click the add button, I want the record to display on the next page, either for editing, or for printing. Though I can't seem to get it to work.

I've tried the ccgetfromget to get the primary key (record_id) but when i redirect it's just giving me a 0 and displays nothing.

Any ideas?
View profile  Send private message
Chris__T


Posts: 339
Posted: 02/24/2010, 7:36 AM

Worked something out. Probably more work than was needed. :)

On Add page, create custom code in the After Insert Event:

  
dim x  
x = form.field.value  
response.redirect("add_redirect.asp?s_field="&x)  

This takes the field I'm going to search on for the record_id. It sends it via url to the add_redirect page. On this page, I setup a simple grid just to have a form on it.

In the Before Show event for this page:
  
dim check  
  
check = CCDLookUp("record", "table", "field=" &_  
    DBConnection1.ToSQL(CCGetFromGet("s_field",0), ccsInteger) , DBConnection1)  
  
Response.Redirect("http://myserver/myproject/print.asp?record_ID=" & check & "")  
This looks up the record_id based on the field we sent through the url. It then redirects to my print page, with the proper record_id, which will bring up the record I want.
View profile  Send private message
andrewi

Posts: 162
Posted: 02/24/2010, 3:23 PM

You could do this without the call to a second page by putting all the code into the After Execute Insert event. Roughly:

	  
dim x    
x = form.field.value    
  
dim check    
check = CCDLookUp("record", "table", "field=" & x )  
    
Redirect = "print.asp?record_ID= " & check   
  


The Redirect variable is available in the After Execute Insert event. Just put the relative path to the page you want to show, and codecharge will handle the redirection. Not sure whether it's in the After Insert event; you might have to change events.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.