This may not be very concise programming, but I'm a newb. Here's my basic problem, the following programming uses a certain number of the beginning characters of an entered address field to check for possible duplicates in its own form as well as another form in the same database. If possible duplicates are found, a warning is posted in another element.
This warning system seems to work very well for my "Friends and Listeners" form, but in "Sticker Requests", where this programming resides, it flags almost every new form as a possible duplicate. It also seems that the forms that are flagged are just flagged because the first two digits are similar.
Any ideas why this would be?
if addressLength > 14
then
{
alteredAddress = @Left(address0, 9) + ".."
}
else
{
if addressLength = 14 or addressLength = 13
then
{
alteredAddress = @Left(address0, 8) + ".."
}
else
{
if addressLength = 12 or addressLength = 11
then
{
alteredAddress = @Left(address0, 7) + ".."
}
else
{
if addressLength <= 10 and addressLength > 7
then
{
alteredAddress = @Left(address0, 6) + ".."
}
else
{
alteredAddress = address0
}
}
}
}
If @Add then
{
dupAddress = @XLookup(@Filename, alteredAddress, "Friends and Listeners!address0", "address0")
if dupAddress <> "" then
{
if @Instr(Problems,"Possible duplicate address in Friends and Listeners") = 0 then
{
Problems = "Possible duplicate address in Friends and Listeners database;" + Problems
}
}
dupAddress = @XLookup(@Filename, alteredAddress, "Sticker Requests!address0", "address0")
if dupAddress <> "" then
{
if @Instr(Problems, "Possible duplicate address in Sticker Requests") = 0 then
{
Problems = "Possible duplicate address in Sticker Requests;" + Problems
}
}
}