Megan
Posts: 35
|
| Posted: 09/21/2006, 10:58 AM |
|
I have a screen that I want a number to be automatically generated. I've written the code to do this, but unfortunately it's working too well. I only want this code to run when a new record is being added. However, the code is running no matter if I add or update.
Basically, I've created a function I've called "GetListingNO" that's been created in the common.asp file. On my screen that 's used for adding/editing/deleting records, I call this code in the DefaultValue property on that particular text box. When I look at the code behind the screen, this is what it states to run the code:
If Not FormSubmitted Then
If IsEmpty(ListingNO.Value) Then _
ListingNO.Value = GetListingNO()
End If
This code was automatically generated by CodeCharge - not by me. I have not customized any of the code withing that screen. If I understand this correctly, it's looking at my text box to determine if it's empty or not. If it is, then it runs my custom code. If it isn't, then it shouldn't. However, it's not working that way. I've created some debugging that displays the value I'm trying to generate using the Response.Write command in my custom code. when I'm editing a record and there's already a listing number, the custom code is running and generating a new number, but it doesn't replace the number that is already created and displayed in the text box (which is good as I don't want the previous number to be replaced or edited). I don't want the custom code to run while editing a record at all - only when adding.
Any suggestions? Thanks for your help and advice.
Megan
|
 |
 |
|