Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Acess to Tables
Message
De
18/01/2005 11:27:59
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00978042
Message ID:
00978141
Vues:
33
This message has been marked as the solution to the initial question of the thread.
Neil

Does it fail only on the ELSE part? You USE the table but don't actually SELECT it. As far as VFP knows you're still using the table you were before the USE (which presumably doesn't have this index order). What you want is:
IF USED("C:\logging\UserLog.dbf")
   SELECT USERLOG   && don't want path of table here either as it's supposed to be a work area or alias.
   SET ORDER TO PDMUSERID   && PDMUSERID
ELSE
   USE 'C:\logging\UserLog.dbf' IN 0 SHARED ORDER PDMUSERID  && can spec. order in the USE 
   Select USERLOG
ENDIF
HTH

Terry

>Thankyou Jim,
>
>I have incorporated this in my code but I get a problem setting the index. Done this manually and it works fine but when I run the program I get an error stating cannot find index PDMUSERID> Here is my code. I dont understand why it cant set the index
>
>
>LOCAL lcusername, lcuserstate
>
>thisform.WindowState = 1
>
>lcusername = ALLTRIM(READINI( "PREFS", "LASTUSER", "P:\QUESTPDM.INI"))
>lcusertate = ''
>
>= WRITEINI( "PREFS", "LASTUSER", thisform.combo1.displayvalue, "P:\QUESTPDM.INI")
>
>IF USED("C:\logging\UserLog.dbf")
>   SELECT 'C:\logging\UserLog.dbf'
>   SET ORDER TO PDMUSERID   && PDMUSERID
>ELSE
>   USE 'C:\logging\UserLog.dbf' IN 0 SHARED
>   SET ORDER TO PDMUSERID   && PDMUSERID
>ENDIF
>
>INSERT INTO 'userlog' (pdmuserid, domuserid, datetimei, insystem) VALUES (thisform.combo1.displayvalue, SYS(0), DATETIME(), 'In')
>
>! U:\questpdm\questpdm.exe
>
>IF USED("C:\logging\UserLog.dbf")
>   SELECT 'C:\logging\UserLog.dbf'
>   SET ORDER TO LOCATE   && ALLTRIM(PDMUSERID)+ALLTRIM(INSYSTEM)
>ELSE
>   USE 'C:\logging\UserLog.dbf' IN 0 SHARED
>   SET ORDER TO LOCATE   && ALLTRIM(PDMUSERID)+ALLTRIM(INSYSTEM)
>ENDIF
>
>SEEK 'lcusername'+'In'
>
>REPLACE UserLog.DateTimeO WITH DATETIME(), UserLog.Insystem WITH 'Out'
>
>CLEAR EVENTS
>QUIT
>
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform