Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LNKFILES.DLL
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00160686
Message ID:
00162225
Views:
36
Hi Marcel,

You're welcome.

Just because the link file exists doesn't necessarily mean that the target file does. In your code sample, you assume that because the FILE() function returns .F. that it's a long file name, and call the ShortToLong() function I wrote. However, if that function doesn't find the file, it returns an empty string, which you don't check for. While I don't have too much experience with General fields, I'd suggest the following modification to your code:
llIsShort = ("~" $ lcfile)
IF llIsShort
  lclongname = ShortToLong(lcfile)
ELSE
  lclongname = lcfile
ENDIF
IF NOT EMPTY(lclongname) AND FILE(lclongname)
  APPEND GENERAL GenField FILE (lclongname) LINK
  MODIFY GENERAL GenField
ELSE
  = MESSAGEBOX("The file " + lcfile + " does not exist!", 64, "File Not Found")
ENDIF
Naturally, the field "GenField" referenced above should be modified to reflect the field name in the table you're working with. If you get the messagebox, you'll know that the file doesn't exist.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform