J
|
Jane 9/5/2006 |
Hi, Function BeforeAdd(dict) strSQLExists = "select * from TableName where Suite=" & dict("Suite") &" and Bed = " & dict("Bed") & " and StartDate = '" & dict("Start Date") & "' and EndDate = '" & dict("EndDate") & "'" set rsExists = CreateObject("ADODB.Recordset") rsExists.Open strSQLExists, dbConnection if not rsExists.eof then ' if record exists do something Response.write "this record exist. Please enter correct data" BeforeAdd = false else ' if dont exist do something else BeforeAdd = True end if rsExists.Close : set rsExists = Nothing End Function
|
M
|
mfred author 9/5/2006 |
It did not do anything. I changed the table name and verified the field name. No error occured but duplicate entries still passed through. Any ideas? Can I sent the ASP file. If you can fix this, I can pay. |
J
|
Jane 9/6/2006 |
Hi, |
A
|
ashumak 9/15/2006 |
If the table is Results, and the field I dont want to allow dupl;icates in is Num, how would I chnage the code? |
J
|
Jane 9/15/2006 |
Alan, Function BeforeAdd(dict) strSQLExists = "select * from Results where Num=" & dict("Num") set rsExists = CreateObject("ADODB.Recordset") rsExists.Open strSQLExists, dbConnection if not rsExists.eof then ' if record exists do something Response.write "this record exist. Please enter correct data" BeforeAdd = false else ' if dont exist do something else BeforeAdd = True end if rsExists.Close : set rsExists = Nothing End Function |
A
|
ashumak 9/15/2006 |
Sorry, it's a text field set as a us phone number. |
J
|
Jane 9/15/2006 |
If field type is Text you only need to add single quotes: Function BeforeAdd(dict) strSQLExists = "select * from Results where Num='" & dict("Num") &"'" set rsExists = CreateObject("ADODB.Recordset") rsExists.Open strSQLExists, dbConnection if not rsExists.eof then ' if record exists do something Response.write "this record exist. Please enter correct data" BeforeAdd = false else ' if dont exist do something else BeforeAdd = True end if rsExists.Close : set rsExists = Nothing End Function |
A
|
ashumak 9/19/2006 |
This is what I already have. We send emails out to notify when the lead is added...How do I put two different functions in place, and I guess the duplicate check would need to be first? And would it send an email anyways if the duplicate is found? |
![]() |
Sergey Kornilov admin 9/19/2006 |
Alan, BeforeAdd = False
|
A
|
ashumak 9/19/2006 |
Like this??? |
A
|
ashumak 9/25/2006 |
Nope. Tried it. Twice it sent me back to login, third time it took the lead. |
B
|
berkeleyjw 9/28/2006 |
Alan,
|
A
|
ashumak 9/28/2006 |
See above...that's exactly what I tried. |
B
|
berkeleyjw 9/28/2006 |
Alan, |