NeifeCare,
Had to read this a few times, but from what I understand You have a program written in VFP that has a table named 'Printer.dbf'. Each person that runs the app has this printer table on their local machine (it is not in a common place on a network).
Using that assumption, You will have to write a program / script to do the change. VFP is ODBC complient so if you do not have VFP you will have to connect to it and run it throught the ODBC driver. This also means you have to run this code on every computer that has the Application.
You will have to create a line of code for each printer you want to change. Do not worry if the user does not have that printer in their PRINTER.DBF. The code below will not crash if they do not have it in their table.
Assuming you have VFP, Here is sample VFP code to do the job.
when you start VFP, in the Command window type "MODIFY COMMAND FIXPRINTER"
Code:
LOCAL lcDir as Char
LOCAL lcFile as Char
lcDir = "C:\directory\structure\2table\"
lcFile = lcDir + " printer.dbf"
*
USE (lcFile) ALIAS Prntfile exclu
REPLACE ALL ColumnName WITH "NewPrinterName1" WHERE ALLTRIM(lower(FieldName)) = "oldprintername1"
REPLACE ALL ColumnName WITH 'NewPrinterName2' WHERE ALLTRIM(lower(FieldName)) = 'oldprintername2'
...........etc
CLOSE ALL
QUIT
The UPDATE command can be used instead of REPLACE
Code:
LOCAL lcDir as Char
LOCAL lcFile as Char
lcDir = "C:\directory\structure\totable\"
lcFile = lcDir + " printer.dbf"
*
UPDATE (lcFile) SET ColumnName = "NewPrinterName1" WHERE lower(alltrim(ColumnName1 )) = "oldprintername1"
UPDATE (lcFile) SET ColumnName = 'NewPrinterName2' WHERE lower(alltrim(ColumnName1 )) = 'oldprintername2'
...........etc
CLOSE ALL
QUIT
Save the File with CTRL+S
If any line is underlined there is a Syntax error on that line.
If not errors then do a Ctrl+W
(Or use the VFP menu to save the file then Exit VFP. )
(P.S. VFP does not care if you use " or '. Just do not mix them on the same line of Code.
This will create a file FIXPRINTER.PRG
Save this file to an external storage device.
Go to each computer and start VFP and in the command widow type "DO E:\FIXPRINTER"
Adjust "E:" to whatever the external device is
Or if all computer are connected to a common domain, you can place the FIXPRINTER.PRG is a common location to all computers.
Then as you go to each computer start VFP
in the command window type
DO '\\domain.server\location\fixprinter.prg'
I wrote this in a hurry, so if there are any errors, I'm sure someone will jump in and straighten me out. I have meetings most of today so I will not be back till Tuesday to check the site.
Hope this helps you.
David W. Grewe
Dave