Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server-Side variable problem - Help?!

Status
Not open for further replies.

computergeek

Programmer
May 23, 2001
193
CA
Hello,

I am trying to track whether the user is adding or just updating the record. On the page I have several recordsets (some for just populating dropdown lists), formmanager dtc, and a number of textbox dtc's. OnClick of the add button I set a variable add_tank_trans=true, then when the user clicks the Save button I check this variable, if true I execute an insert, else I update. The add_tank_trans variable does get set to "TRUE", but seems to get set to empty when the user clicks the save button?! So when the Save function checks it value it is neither true or false... therefore the processing fails. Why is this variable being set to empty?

<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Dim add_tank_trans

Sub Btadd_onclick()
' Set flag for additon of new Tank record to true
add_tank_trans = true
' Move to the end of the recordset and clear fields
rsTankbyID.moveLast
rsTankbyID.addRecord
End Sub

Sub btsave_onclick()
if add_tank_trans = true then
Response.Write &quot;add_tank_trans = True&quot;
' Insert record
else
rsTankbyID.updateRecord()
' Check for errors etc.
end if
' more code here...

' variable is set to false at the end of the script
add_tank_trans = false

End Sub

I'm stuck...please help. Thanks.

Computergeek



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top