I have a standard form where the user enter's a Contact's information. After the Last Name is entered, I'm using an Embed to look-up the First and Last Name in the Contact table to see if it exists, and if so, warn the user.
I got everything to work except the last step of adding a new record. The first problem was it changed to Change mode and it saved the existing record. I tried to look for ways to clear out the data and change the record pointer but I got an error "Record Not Available".
Here's the Embed Source I have so far:
! Lookup Existing Contact
GET(CONTACT,CON:ByLNameFName2)
IF ERRORCODE() = 0
IF CON:Company = ''
DuplicateNotice = 'WARNING: ' & CLIP(CON:Fname) & ' ' & CLIP(CON:Lname) & ' already exists in the Contact table with NO COMPANY set'
ELSE
DuplicateNotice = 'WARNING: ' & CLIP(CON:Fname) & ' ' & CLIP(CON:Lname) & ' already exitss in the Contact table with the Company: ' & CLIP(CON:Company)
END
! Save Name, Clear Record
LocalRequest = InsertRecord
DO PrimeFields
After the lookup, how change I change it back to Insert mode?
I got everything to work except the last step of adding a new record. The first problem was it changed to Change mode and it saved the existing record. I tried to look for ways to clear out the data and change the record pointer but I got an error "Record Not Available".
Here's the Embed Source I have so far:
! Lookup Existing Contact
GET(CONTACT,CON:ByLNameFName2)
IF ERRORCODE() = 0
IF CON:Company = ''
DuplicateNotice = 'WARNING: ' & CLIP(CON:Fname) & ' ' & CLIP(CON:Lname) & ' already exists in the Contact table with NO COMPANY set'
ELSE
DuplicateNotice = 'WARNING: ' & CLIP(CON:Fname) & ' ' & CLIP(CON:Lname) & ' already exitss in the Contact table with the Company: ' & CLIP(CON:Company)
END
! Save Name, Clear Record
LocalRequest = InsertRecord
DO PrimeFields
After the lookup, how change I change it back to Insert mode?