Subject |
Re: REFERRING TO A VARIABEL TO REP A VALUE |
From |
ED FURCHE <ED@UNIV-COMPUTERS.COM> |
Date |
Mon, 13 Nov 2023 18:05:14 -0500 |
Newsgroups |
dbase.getting-started |
ED FURCHE Wrote:
> Ken Mayer Wrote:
>
> > On 11/12/2023 9:17 AM, ED FURCHE wrote:
> > > I HAVE USED THIS BEFORE BUT DONT REMEMBER HOW.
> > >
> > > I WANT TO REFER TO A VARIABLE IN A COMMAND
> > >
> > > EXAMPLE CTR=1
> > > USE C:\BACKUP\CTR\CHECK.DBF TO ADDRESS USE C:\BACKUP\1\CHECK
>
> I TRIED THIS DIDNT WORK. CTR=1
> USE C:\BACKUP\&CTR\CASEY.DBF ALIAS OLDFILE
> > >
> >
> > You would do this in a couple ways, the easiest is to build the command
> > as a string, and insert the variable into it:
> >
> > cCmd = [USE C:\BACKUP\]+CTR+[CTR\CHECK.DBF TO ADDRESS USE C:\BACKUP\1\CHECK]
> >
> > Note that by using the square brackets as delimiters you don't have any
> > confusion with quotes ...
> >
> > To execute the command (use macro expansion):
> >
> > &cCmd.
> >
> > Another way is:
> >
> > USE C:\BACKUP\&CTR.\CHECK.DBF TO ADDRESS USE C:\BACKUP\1\CHECK
> >
> > But that gets a bit hard to read, and it's easy to make mistakes. Also
> > if the value of your variable includes spaces, it can be a problem,
> > you'd have to deal delimiters ...
> >
> > Ken
> >
> >
> > --
> > *Ken Mayer*
> > Ken's dBASE Page: http://www.goldenstag.net/dbase
> > The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
> > dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
> > dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
> > dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
> > dBASE DOS to Windows Tutorial:
> > http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm
> >
> I TRIED THIS...
CTR=1
USE C:\BACKUP\+&CTR.\CHECK.DBF
THEN THIS...
CTR=1
USE C:\BACKUP\+&CTR\CHECK.DBF WIDTHOUT THE PERIOD (I FELT THAT YOUR PERIOD WAS A MISTAKE)
NEITHER ONE WORKED...
ED
|
|