Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Search for Existing Record

Search for Existing Record

Search for Existing Record

I can't believe I'm having such a hard time getting this to work!  It's SO much easier in dBase/FoxPro!!  (ok, I feel better now)

I need to take what a user enters in a field (Company) and look it up to see if it already exists so I can stop them from entering duplicates (numerous ones already exist so I can't change the Key in the Dictionary).

I read somewhere that you have to create aliases in order to do key lookups, so I created one for the COMPANY file.  This is what I've been trying:

! Check for existing COMPANY
IF LocalRequest = InsertRecord
    ! Open secondary Company file
    COMALIAS:Company = CO:Company
    ! Check if Company key exists
        MESSAGE('Company Found: ' & COMPANYALIAS:Company)
        MESSAGE('Company NOT Found: ' & COMPANYALIAS:Company)

Why isn't this working?  It keeps coming up "Company NOT Found" for existing and non-existing values and never hitting EOF on the alias.

RE: Search for Existing Record

I dont know if you are putting the correct keys but the typical way is this:

 in stead of


Hope this help

RE: Search for Existing Record

IT WORKED!!  Thank you very much!!

RE: Search for Existing Record


Even though IF ERROR() will work, IF ERRORCODE() is the more optimized way since ERRORCODE() is a integer number and ERROR() is a string.


RE: Search for Existing Record

Interesting... okay, I'll try using that instead.  I'm just surprised EOF didn't work, but then I don't think I had GET correctly.  Thanks, ShankerJ!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close