If the user types it in you can simply conconate the strings together.
Version 3+ example:
clear
@ 2,2 say "enter a drive Letter: " get DriveLetter
Path= &Driveletter + ":" + Path
use Path index anything
return
please note that the above is an example, I haven't actually tested it but it should work (even though this is for version 3 plus). It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
Miggy, thanks but I've tried that. The problem is the COPY FILE command doesn't recognize 'Path'. It thinks 'Path' is the TO Filename. Here is how I tested this at the dot prompt.
DriveLetter="F"
Path=DriveLetter+":"
COPY FILE DATABASE.DBF TO PATH
What happens is the file DATABASE.DBF gets copied as PATH instead of being copied to the F: drive.
What I need to have happen is to have the F: appended onto the front of the DATABASE.DBF file so that DATABASE.DBF gets copied to the F: drive.
OH NOOOO!!! What have you done?!?! You've ruined my (almost) perfect code!! <crying sounds>
Just kidding, I had purposely given you the answer; however, I placed it in the wrong spot hoping that you would catch it and jog your memory. I guess it [the answer] was a speeding bullet. Anyway, I wrote this little bit of code to show you. If you want to test it out then....
1) Save the following code to a PRG file. NOTE: Don't forget to change the database name
that is shown in red to a file that exists...or make
a small DBF that will fit on the floppy. I created
one with just 3 fields and only 2 records for testing
this code.
2) Insert a blank disk in drive [red]A:[/red] and create a
directory on it and name it [red]TEMP[/red].
3) On your [red]C:[/red] drive, create a directory in the
root of the drive and call that directory [red]TEMP[/red] as well.
4) Start DB and run this program and answer the questions.
5) If you still can't figuer out what you are doing
wrong or you are having problems with these
directions, post again.
**** Start of Code ****
SET TALK OFF
SET ECHO OFF
MyDrive = " "
MyPath = "\temp\"
MyFile = " "
AllMe = "x"
CLEAR
@ 1,3 SAY "Enter Drive Letter (A or C) :" GET MyDrive
@ 3,3 say "Enter an 8 char filename :" GET MyFile
READ
Allme = MyDrive + ":" + MyPath + MyFile + ".dbf"
COPY FILE [red]TestMe.dbf[/red] TO &AllMe
QUIT
**** End of Code ****
Hope this helps some. Let me know one way or the other, in the meantime, good luck.
--MiggyD It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.