Andy Trezise
2004-11-08 14:01:36 UTC
I have an age old problem when trying to switch from one database (and the
tables contained within it) to another during my application (VFP8). I just
want the user to be able to switch from a LIVE database to an ARCHIVE
database.
1. The initial problem is that if my database is held directly under the
folder from where the EXE runs and this folder has the same name as the one
I used under development then the application seems to instinctively to use
that database rather that the implicit one that I tell it.
2. Whatever I try I can't seem to get my application to switch from one
database to the other. The operation succeeds and DBC() always returns the
correct database name but when I try and open a table for some reason it
opens the table from my live database. I am using a hot key (ALT+A) to call
a routine as follows:
Function Switch_DB()
lArchive = !lArchive
IF lArchive
cDB = C:\DATAFILES\MYDB.DBC
ELSE
cDB = C:\DATAFILES\ARCHIVES\MYDB.DBC
ENDIF
CLOSE ALL DATABASE
OPEN DATABASE &cDB
SET DATABASE TO &cDB
RETURN
tables contained within it) to another during my application (VFP8). I just
want the user to be able to switch from a LIVE database to an ARCHIVE
database.
1. The initial problem is that if my database is held directly under the
folder from where the EXE runs and this folder has the same name as the one
I used under development then the application seems to instinctively to use
that database rather that the implicit one that I tell it.
2. Whatever I try I can't seem to get my application to switch from one
database to the other. The operation succeeds and DBC() always returns the
correct database name but when I try and open a table for some reason it
opens the table from my live database. I am using a hot key (ALT+A) to call
a routine as follows:
Function Switch_DB()
lArchive = !lArchive
IF lArchive
cDB = C:\DATAFILES\MYDB.DBC
ELSE
cDB = C:\DATAFILES\ARCHIVES\MYDB.DBC
ENDIF
CLOSE ALL DATABASE
OPEN DATABASE &cDB
SET DATABASE TO &cDB
RETURN