INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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.

Jobs

Issue with Seek

Issue with Seek

(OP)
Hi,

Can anyone point out what is wrong here? I'm getting an error dialog of "Compile, Function name is missing" when saving.

CODE -->

lnPK = ActionDetail.task_pk
SEEK (lnPK, 'task', 'PriKey') 

where 'ActionDetail.task_pk' is valid and is equal to 16
and 'task' is the lookup table
and 'PriKey' is the lookup table's index built on task.pk
and task table does contain a record whose PriKey value is 16

I've also taken the space from between k and (. "seek (" and/or "seek(" - same error.
Thanks,
Stanley


RE: Issue with Seek

What if you change the SEEK part to:

CODE

IF SEEK (...)
   * Do something
ENDIF 


or to:

CODE

SEEK lnPK IN Task ORDER PriKey 

That is, you're using the SEEK function rather than the SEEK command, but you're not doing anything with the result.

Tamar

RE: Issue with Seek

(OP)
Hi Tamar,

I need to move the pointer in the 'task' table if found('task') returns true.

seek something
if found()
do something

I can see the logic in both your examples. Just trying to understand what the function name missing was about...

Thanks,
Stanley

RE: Issue with Seek

Well, SEEK is both a function and a command. The way you used it confused the compiler.

I would prefer using the function, as its return value already tells you the FOUND() status. But if your VFP version is not having it, you must use the command variant.

If you're just used to the command variant, and have code following with IF FOUND(), then make it this way, perhaps:

CODE

llFound = SEEK(lnPK, 'task', 'PriKey')

IF llFound && instead of FOUND()
...
ENDIF 

I tested SEEK(lnPK, 'task', 'PriKey') and SEEK (lnPK, 'task', 'PriKey') at the command line and both variants cause a "function name is missing )" error, but ? SEEK(lnPK, 'task', 'PriKey') or ? SEEK (lnPK, 'task', 'PriKey') work. The ? makes clear the SEEK function is meant and not the command working on whatever the brackets return.

I always use SEEK() within IF SEEK() lines, it makes clear the SEEK function is meant and the compiler doesn't get confused.

Bye, Olaf.

RE: Issue with Seek

SEEK, whether you use the command or the function, automatically moves the record pointer.

Tamar

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!

Resources

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