Subject |
Re: REFERRING TO A VARIABEL TO REP A VALUE |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Mon, 13 Nov 2023 17:28:36 +0200 |
Newsgroups |
dbase.getting-started |
On 2023/11/13 17:06, ED FURCHE wrote:
> I TRIED THIS DIDNT WORK. CTR=1
> USE C:\BACKUP\&CTR\CASEY.DBF ALIAS OLDFILE
Embedding macros in strings can be tricky and it can be hard to figure
out what is causing an error.
Rather use the alternative that Ken suggested of building the command as
a string in a variable. The command can then be executed by using the
macro operator.
It may seem to be more work but this way has the distinct advantage that
one can print and examine the string to make sure the command has been
built correctly. Once you are satisfied that the command is correct you
can use the macro operator to execute the string.
CTR = 1
CMD = 'USE C:\BACKUP\'+CTR+'\CASEY.DBF ALIAS OLDFILE' //Build command
?CMD //View the command. Comment out once you're happy with the command
//&CMD //Un-comment to use the macro operator to execute the command
Mervyn
|