Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test for active database
Message
De
12/08/2009 16:49:48
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01417701
Message ID:
01417705
Vues:
102
This message has been marked as the solution to the initial question of the thread.
>Here's the problem
>I developed a short cut key (alt-L) that prepares the screen for a cut and paste input into a text file - from there the data is processed into 2 or 3 databases.
>
>This operation is repeated umpteen times a day and alas the operators get confused sometimes and end up pressing the shortcut twice and low and behold, they end up pasting material into an active database and corrupting the file.
>
>i have therfore only been able to provide an alert that they have corrupted the main database and to use a backup before continuing - a warning AFTER the fact.
>
>question
>
>is there a way to test that when the paste occurs into a database that it is the CORRECT database it is appending into. that the program will not accept the paste unless it is the correct database - perhaps a command BEFORE the 'append from m.txt type sdf' to test what the database is that is being appended and to issue an abort is database is not correct one.
>
>perhaps something like this: (let's call the correct database right.dbf)
>
>close alte
>modi file m.txt &&& here is here the cut and paste occurs
>CLOS ALTE
>CLEAR
>
>if active database is not right.dbf && here is where i need the correct code)
>messagebox("Incorrect database - process has been aborted")
>close all
>return
>endif
>
>append from m.txt type sdf && if program passes the above test then program will proceed
>
>thanks for your continued help.
>
>k

DBF() function will return the name of the open table.
IF JUSTSTEM(DBF()) == "RIGHT"
   APPEND FROM m.txt TYPE SDF
ELSE
  MESSAGEBOX('Not the right database')
ENDIF
I don't know what all conditions need to be for you to consider it's the correct database.
Charles

"The code knows no master." - Chuck Mautz
"Everybody is ignorant, only on different subjects." - Will Rogers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform