I've written some code to enter a new record into my database with an automatically issued number. I couldn't figure out how to run the code by itself with a button so I created an a5w page with it inside and I'm opening it with an onclickevent "Open an .a5w page, static HTML page, URL, or PDF document". Here's the code I need to run:
The code runs properly and does what I need it to do inside the a5w page but I CAN'T AUTOMATICALLY CLOSE the window afterwards. I've read on this forum that there is a problem with the usual methods of closing a window (close last opened window or close parent window) when your window contains an a5w page.
Can anyone help me close this window automatically or is there another way to run the code without opening one in the first place?
Code:
<%A5 dim conn as sql::connection flag = conn.open("::Name::MVWKS") dim sqlCommand as c sqlCommand = "Select MAX(tnumber) from [tooling card info] where left(tnumber,1)='0'" flag = conn.execute(sqlCommand) dim rs as sql::ResultSet rs = conn.ResultSet dim next as n next=rs.data(1) next=next+1 dim addzero as c addzero=next addzero="0"+addzero dim user as c user=upper(left(a5ws_getcurrentuser(),3)) dim args as sql::Arguments args.add("nextnumber",addzero) args.add("drawnby",user) args.add("nowdate",now()) args.add("fileloc","P:\Secured\ReleasedPDF\Tooling"+chr(92)+left(addzero,3)+chr(92)+addzero+".pdf") sqlCommand = "insert into [tooling card info] (tnumber, Revision, Drawn_by, Status, File_location, Department, File_type, File_ext, Last_edit_by, Issued) values (:nextnumber, '0', :drawnby, 'New Card', :fileloc, 'MFG ENG', 'SolidWorks', 'slddrw', :drawnby, :nowdate)" conn.execute(sqlCommand,args) args.clear() end %>
Can anyone help me close this window automatically or is there another way to run the code without opening one in the first place?
Comment