This topic is locked

Before Record Added

12/18/2007 1:29:34 PM
ASPRunnerPro General questions
K
KingDean author

Current Code is on the Create Work Ticket add.asp
Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Add form is represented as a 'Field name'-'Field value' pair
'** Check if specific record exists ****

*strSQLExists = "select from work_order where status<>'Processing'"** I think i need to add another line here to look at a field for barcode and make sure that no one barcode is entered into the system twice with it being processing.

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection
if not rsExists.eof then

' if record exists do something
else

' if dont exist do something else
end if

rsExists.Close : set rsExists = Nothing
BeforeAdd = True
' set BeforeAdd to True if you like to proceed with adding new record

' set it to False otherwise

Sergey Kornilov admin 12/18/2007

What is the question here?

K
KingDean author 12/18/2007

I think i need to add another line here to look at a field for barcode and make sure that no one barcode is entered into the system twice with it being processing
The item in red, i think that i need to add some more code. I don't know how to do that or what it might be?
This is what i want.
When the user prepares a request for work, i want the system to look in the work order table (where all request are stored) and verify that (example) barcode 10012 doesn't exist in the table, if it does exist, i need to verify that the request is closed before saving to the table.
I don't want a user to send me duplicate request for an item until all request for that item have been fixed.
?

J
Jane 1/11/2008

Hi,
try to add barcode to the where clause of your SQL query:

strSQLExists = "select * from work_order where status<>'Processing' and barcode='" & dict("barcode") & "'"