PSSQA.TXT ********************************************************** Answers to Commonly Asked Question About Microsoft(R) FoxPro(R) for MS-DOS(R) Version 2.6a (C)1994 Microsoft Corporation. All Rights Reserved. ********************************************************** ======== CONTENTS ======== Part Description ---- ----------- 1 Network Issues 2 Converting from FoxPro 2.0 to FoxPro 2.6 for MS-DOS 3 Printing Issues 4 Screens 5 Importing Data 6 BROWSE Command 7 Creating Applications ---------------------------------------------------------- ====================== Part 1: Network Issues ====================== Overview of Questions --------------------- 1 When a second user loads Microsoft FoxPro for MS-DOS on my network, the user receives the error message "File in use by another." How can I correct this problem? 2 In a network environment, where does FoxPro create temporary files? 3 I get "File Access Denied" Error Message When Writing to File. How can I correct this problem? 4 How do I resolve FoxPro "Sharing Violation Reading Drive" Error? ---------------------------------------------------------- Question 1 When a second user loads Microsoft FoxPro for MS-DOS on my network, the user receives the error message "File in use by another." How can I correct this problem? Answer 1 If you are on a peer-to-peer network other than Windows for Workgroups, you must first load MS-DOS SHARE and then verify that the FoxPro files are marked as read only. FoxPro uses a resource file called FOXUSER to store information about windows, color sets, and other FoxPro objects. The FOXUSER database can be shared only if the file is marked read only. If you receive this error message when you try to open a database file, make sure that all users have the SET EXCLUSIVE setting OFF. ---------------------------------------------------------- Question 2 In a network environment, where does FoxPro create temporary files? Answer 2 FoxPro creates temporary files in the current working directory unless you specifically designate an alternate location by including one or more of the EDITWORK, SORTWORK, PROGWORK and/or TMPFILES statements in the CONFIG.FP file. If local workstations have sizable hard drives with plenty of free space or have large amounts of RAM, you can improve performance in the multi-user environment by placing FoxPro temporary work files on the local drive or on a RAM drive. Redirecting these files to a local drive or a RAM drive provides additional speed by reducing the need to access the network drive. On small networks that have older workstations with slow hard drives, you might experience better performance by leaving FoxPro temporary files on the file server. When in doubt, direct temporary files to the local hard drive. ---------------------------------------------------------- Question 3 I get "File Access Denied" Error Message When Writing to File. How can I correct this problem? Answer 3 The steps you must use to resolve this problem depends on the network product you are using. For a LANtastic network, do the following: 1. Check the files and locks on the SHARE command in the AUTOEXEC.BAT file. The following are the recommended settings: share /f:5120 /l:500 2. Verify that the .EXE, .RSC, and .OVL files are marked as read-only. If necessary, change the security using the MS-DOS ATTRIB command (for example, ATTRIB +R ). 3. Ensure that the CONFIG.FP file on the server redirects the OVERLAY= to a directory other than the directory containing the FOXPRO.EXE file. For a Novell network, do the following: 1. Check the user's privileges. 2. Have the user log in as a supervisor and repeat the operation. 3. Ensure that the .EXE, .ESO and .ESL files are marked as read-only. If necessary, change the security using the MS-DOS ATTRIB command (ATTRIB +R ). LANtastic is manufactured by Artisoft, Inc. and Novell products by Novell, Inc., both vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability. ---------------------------------------------------------- Question 4 How do I resolve FoxPro "Sharing Violation Reading Drive" Error? Answer 4 The following are six troubleshooting steps for this error: - Verify that each user has a FOXUSER.DBF file. - Verify that the CONFIG.FP file on the server includes the EXCLUSIVE=OFF statement. If EXCLUSIVE=OFF is used, it is possible to share database files. - Verify that the CONFIG.FP file on the server includes the RESOURCE=OFF statement, or that each user's FOXUSER.DBF and FOXUSER.FPT files are marked as read-only. - If you are using the LAN version of FoxPro 2.0 , verify that the FOXPROL.EXE, FOXPROLX.EXE, and FOXR.EXE files are marked as read-only. If you are using FoxPro 2.5 for MS-DOS, verify that the FOXPRO.EXE, FOXPROX.EXE, and FOXR.EXE files are marked as read-only. - If you use the Distribution Kit to create a standalone application, verify that the .EXE files are marked as read-only. - If you create compact executable files, mark the .ESL and .ESO files as read-only. - In some cases, the SHARE utility must be loaded on the server and on each workstation. Specify the /F and /L parameters as follows: SHARE /F:5120 /L:500 ---------------------------------------------------------- =========================================================== Part 2: Converting from FoxPro 2.0 to FoxPro 2.6 for MS-DOS =========================================================== Overview of Questions --------------------- 1 Are my existing FoxPro 2.0 screens and reports compatible with FoxPro 2.6? 2 Can I use my existing library files created with the FoxPro 2.0 Library Construction Kit in FoxPro 2.6? 3 Are my existing programs compiled under FoxPro 2.0 compatible with FoxPro 2.6? ---------------------------------------------------------- Question 1 Are my existing FoxPro 2.0 screens and reports compatible with FoxPro 2.6? Answer 1 The structures of the databases created by the power tools have changed in FoxPro 2.6. When you first open screen and report files created in FoxPro 2.0, FoxPro 2.6 ask if you want to convert them to FoxPro 2.6 format. This conversion is a one-way process -- files that have been converted to 2.6 formats may no longer be opened in 2.0. You may want to make backups before converting. For more information about specific FoxPro 2.6 file formats, see "Tables" in the Update manual. ---------------------------------------------------------- Question 2 Can I use my existing library files created with the FoxPro 2.0 Library Construction Kit in FoxPro 2.6? Answer 2 Library files created with the FoxPro 2.0 Library Construction Kit must be relinked before they can be used in FoxPro 2.6. The directory FPD26\GOODIES\LCKUPDAT contains files that allow you to update PLBs built using the FoxPro 2.0 Library Construction Kit for use with FoxPro 2.6 for MS-DOS. If you obtained your PLBs from another source, such as a software supplier or online service, contact that source for updated libraries that work with FoxPro 2.6. To use these files, follow the directions in the LCKUPDAT.TXT file located in the FPD26\GOODIES\LCKUPDAT directory. ---------------------------------------------------------- Question 3 Are my existing programs compiled under FoxPro 2.0 compatible with FoxPro 2.6? Answer 3 Programs compiled under FoxPro 2.0, such as .APP and .FXP files, are not compatible with FoxPro 2.6. To run such applications or programs in FoxPro 2.6, you must rebuild or recompile them. For more information about rebuilding FoxPro 2.0 applications, see "Using Files From Other Platforms" in the Update manual. ---------------------------------------------------------- ======================= Part 3: Printing Issues ======================= Overview of Questions --------------------- 1 When I try to print boxes, ASCII characters are printed instead of boxes. How can I correct this problem? 2 I'm using the Relational Query By Example (RQBE) system to send data to a report. The data in the report is incorrect; the report prints the same record over and over. How can I correct this problem? 3 Why can't I select the printer driver check box in the Printer Setup Dialog box? 4 I'm using a Novell network. I can print by using the Novell CAPTURE command, but the SET PRINTER TO \\SPOOLER command doesn't work. How can I correct this problem? 5 I can't make the printer drivers work in an executable file. How can I correct this problem? 6 How do I start a Print Job from a Page Other Than Page 1? 7 I am having problems printing Labels on a Laser Printer without a printer driver. How can I correct this problem? 8 I get the following error "Cannot Write to Read-Only File" When Printing Report. How can I correct this problem? 9 I get an extra blank line when printing labels. How can I correct this problem? 10 I have NewPage and ResetPage enabled in my data grouping but my page numbering is not reset to 1. How can I correct this problem? 11 I get the following error "File [""] Does Not Exist" printing on LAN Manager. How do I correct this problem? ---------------------------------------------------------- Question 1 When I try to print boxes, ASCII characters are printed instead of boxes. How can I correct this problem? Answer 1 If you are using an HP laserjet printer, the default character set does not include line drawing characters. You can change the default character set by using the controls on the front panel of the printer. You will want to set your default to the PC-8 character set. If you are not using an HP laserjet printer and are using printer drivers, in the Printer Setup dialog, specify a printer setup appropriate for your printer. If you are already using a printer driver, modify the P_CODES database in order to send the proper code for your printer, and rebuild the GENPD.APP file. If you aren't using a printer driver, send the proper escape codes to the printer before you print using the ??? command. ---------------------------------------------------------- Question 2 I'm using the Relational Query By Example (RQBE) system to send data to a report. The data in the report is incorrect; the report prints the same record over and over. How can I correct this problem? Answer 2 When you created the report, you used alias names in your field definitions. To correct the report, simply remove the alias names. For example, a field containing CUSTOMER.NAME should be modified to contain only NAME. ---------------------------------------------------------- Question 3 Why can't I select the printer driver check box in the Printer Setup dialog box? Answer 3 This problem occurs if you are missing the GENPD.APP file, if the _GENPD memory variable is set incorrectly, if the resource file is turned off, or if the FOXUSER file is missing, damaged, or marked as read only. ---------------------------------------------------------- Question 4 I'm using a Novell network. I can print by using the Novell CAPTURE command, but the SET PRINTER TO \\SPOOLER command doesn't work. How can I correct this problem? Answer 4 If you are receiving the error message "Printer not ready," make sure that there are no spaces before or after the \\SPOOLER clauses of SET PRINTER. If the printer information doesn't print until you exit FoxPro, you must issue the SET PRINT TO command in order to release the print spooler. ---------------------------------------------------------- Question 5 I can't make the printer drivers work in an executable file. How can I correct this problem? Answer 5 Open the project to make sure that the GENPD.APP file is included in the project as an application. If it isn't included, add GENPD.APP to the project as an application. To add GENPD.APP as an application, choose the Add push button. In the dialog that appears, choose Application from the Type popup, select GENPD.APP and then choose the Add push button. Note: GENPD.APP is automatically marked as an excluded project element. Rebuild the project and your executable file. Make sure that you distribute the GENPD.APP, FOXUSER.DBF, FOXUSER.FPT, and FOXSWAP.COM files with your executable file. ---------------------------------------------------------- Question 6 How do I start a Print Job from a Page Other Than Page 1? Answer 6 To start a print job at a location other than page 1, set _PBPAGE to the number of the page at which printing should start and create a program that uses the PRINTJOB...ENDPRINTJOB commands. Using the _PBPAGE variable to specify the page number where a print job starts does not work outside of PRINTJOB...ENDPRINTJOB. For example, suppose your printer jammed on page 75 of a 100-page report and all output from page 75 through 100 was lost. The code to re-create the last 25 pages is as follows: _PBPAGE=75 PRINTJOB REPORT FORM C:\FOXPRO2\test.FRX ; ENVIRONMENT PDSETUP TO PRINT ENDPRINTJOB Or, if you just wanted to only print page 75, then set "_PBPAGE=75" and "_PEPAGE=75" in the previous example. ---------------------------------------------------------- Question 7 I am having problems printing Labels on a Laser Printer without a printer driver. How can I correct this problem? Answer 7 Printing labels to a Hewlett-Packard (HP) laser printer without a printer driver requires that certain escape codes be sent to the printer before the command to print the labels. MORE INFORMATION ================ Avery 5161 or 5261 labels measure 1-by-4 inches. One page of labels has two columns of ten labels each. To print this label type, execute code such as the following: SET PDSETUP TO SET DEVICE TO PRINTER ??? CHR(27)+'E' && Reset ??? CHR(27)+'&l8.00C' && Line height 8/48" (LPI 6) ??? CHR(27)+'&l3E' && Top margin 3 lines ??? CHR(27)+'&l56P' && Page length 60 lines SET DEVICE TO SCREEN LABEL FORM TO PRINTER SET PRINTER TO SET DEVICE TO SCREEN NOTE: The escape code lines that contain an ampersand (&) use a lowercase "L", not a number 1. In the label generator, use the following settings: Margin - 3 Width - 34 Number across - 2 Height - 6 Lines between - 0 The above settings are only an example and may need to be modified for specific labels, printers, and applications. For exact escape code sequences, consult your printer's manual. ---------------------------------------------------------- Question 8 I get the following error "Cannot Write to Read-Only File" When Printing Report. How can I correct this problem? Answer 8 Given the following circumstances, the error message "Cannot Write to a Read-Only File" will occur when you try to print a report from within an application (.APP) or an executable (.EXE) program: - The resource file is included in the project. - The resource is set to the included filename. - The REPORT FORM PDSETUP TO PRINT or LABEL FORM PDSETUP TO PRINT command is issued. There are two ways to avoid this problem: - Remove PDSETUP from the command. -or- - Mark the resource file as excluded and ship it along with the .APP or .EXE file. ---------------------------------------------------------- Question 9 I get an extra blank line when printing labels. How can I correct this problem? Answer 9 This behavior existed in dBASE III and FoxBASE. It was changed in FoxPro version 1.02. However, to maintain compatibility with the large installed base of Xbase applications, a design decision was made to revert to the original behavior. To work around this problem, print the label form to a file, open the file with low-level file functions, remove the carriage return/linefeed (CR/LF) characters and send the file to the printer using the MS-DOS COPY command. For example: *--Set the number of lines printed per page and print to a file. _PLENGTH=56 LABEL FORM
ENVIRONMENT PDSETUP TO FILE temp.txt *--Open file and replace the CR/LF pair with null characters. filehand=FOPEN('temp.txt',2) =FGETS(filehand) =FSEEK(filehand,-2,1) =FWRITE(filehand,chr(0)+chr(0)) =FCLOSE(filehand) *--Copy the file to printer and prevent the appearance of the *--MS-DOS screen. HIDE WINDOW SAVE ALL RUN COPY temp.txt LPT1 > NUL SHOW WINDOW ALL ---------------------------------------------------------- Question 10 I have NewPage and ResetPage enabled in my data grouping but my page numbering is not reset to 1. How can I correct this problem? Answer 10 The report has a Bottom Margin setting greater than 0 (zero). Set Bottom Margin to 0 and add the necessary lines to the Page Footer band. For example, if Bottom Margin is set to 2, reset it to 0 and add two lines to the Page Footer band. ---------------------------------------------------------- Question 11 I get the following error "File [""] Does Not Exist" printing on LAN Manager. How do I correct this problem? Answer 11 When the program attempts to open a file, it looks in a particular directory. If it does not find the file there it tries other directories until the file is found. When LAN Manager's "chartime" timer (which defaults to 250 milliseconds) expires, it sends a spool close message to the workstation, and if the program is in the middle of a search for the next file to open, the program exits incorrectly with the error mentioned above. If the chartime parameter in the LANMAN.INI file for the workstation is set to a sufficiently high value, the program will not be interrupted by the spool close message and will work correctly. In LAN Manager version 2.1, the chartime parameter controls the amount of time the spooler waits for additional print data before closing the current spool file and printing it. In earlier versions of LAN Manager, this parameter controls the amount of time to wait for pipe data or comm queue data. For more information about the chartime parameter and the LANMAN.INI file, refer to the LAN Manager documentation or contact Microsoft LAN Manager Product Support Services. Also, see the "Microsoft LAN Manager Administrator's Reference," version 2.1, page 225 ---------------------------------------------------------- =============== Part 4: Screens =============== Overview of Questions --------------------- 1 Every time I try to generate a specific screen, I have to add my supporting screens to the screen set. How can I avoid this problem? 2 When I create a screen set with more than one window, how do I move the cursor from one window to the next? 3 How do I coordinate Browse Windows with Screens? 4 How to Page Through a Format File That Contains a READ? 5 The Cycle Command does not work for desktop screens. How can I correct this? ---------------------------------------------------------- Question 1 Every time I try to generate a specific screen, I have to add my supporting screens to the screen set. How can I avoid this problem? Answer 1 To save these options, you must create a project and include the screens as a screen set. ---------------------------------------------------------- Question 2 When I create a screen set with more than one window, how do I move the cursor from one window to the next? Answer 2 If all the windows in your screen set are controlled with one READ command, use the Page Up key, the Page Down key, or modify the value of the _CUROBJ system memory variable to cycle through the windows of your screen set. If any one of the windows in your screen set is not controlled by the READ command, such as a Browse window, then you must press Ctrl+F1 to cycle through the screen set. ---------------------------------------------------------- Question 3 How do I coordinate Browse Windows with Screens? Answer 3 Page D2-96 of the FoxPro for MS-DOS "Developers Guide" give samples for coordinating Browse windows with screens but omits the SAVE clause in the example. If the optional BROWSE parameter SAVE is omitted, the Browse window will close as soon as any other object is clicked. The code example should be changed to read as follows: IF NOT WVISIBLE("Client List") BROWSE NORMAL NOWAIT NODELETE LAST TITLE "Client List" ; NOAPPEND NOMENU SAVE FIELDS company ; WHEN showgets() ENDIF IF NOT WVISIBLE("Account Details") SELECT details BROWSE NORMAL NOWAIT NODELETE LAST TITLE "Client List" ; NOAPPEND NOMENU SAVE ; FIELDS ; Trans_type:10, ; Trans_date:10, ; Amt:7,Service SELECT clients ENDIF ---------------------------------------------------------- Question 4 How to Page Through a Format File That Contains a READ? Answer 4 Pressing the PAGE UP and PAGE DOWN keys skips one record at a time, forward or backward, in the database and also refreshes the GETs on the screen. Objects can be placed on different pages or different screens by placing a READ command in the format file. The READ command should be placed after the last GET that would appear on each screen. The following format file example places two objects on the first screen and two more on the second screen. To display the objects that are on the next screen, press the PAGE UP or PAGE DOWN key. @5,1 GET @6,1 GET READ @5,1 GET @6,1 GET ---------------------------------------------------------- Question 5 The Cycle Command does not work for desktop screens. How can I correct this? Answer 5 The Cycle command on the Window menu is designed to switch between windows defined on the desktop. When a screen set contains several windows and a desktop screen, Cycle stops on the desktop screen. This is normal behavior, since the Cycle command is intended to be used with window screens, not the desktop. To work around this behavior, define a window with no borders instead of using a desktop screen. This will produce a window that looks like the desktop. The Cycle command is used for cycling through window screens in a screen set or windows defined on the desktop. The shortcut key CTRL+F1 can also be used to cycle through windows on the desktop. ---------------------------------------------------------- ====================== Part 5: Importing Data ====================== Question 1 How do I import a data file into Microsoft FoxPro for MS-DOS? Answer 1 To import a data file, use either the IMPORT command or the APPEND FROM command. If you're receiving the error message "String too long to fit," make sure that no "field" in the source data file exceeds the field capacity for a FoxPro table. See the System Capacities topic in Help for additional information. A wide range of file formats is supported. See the Language Reference manual for a complete list of the supported file formats. ---------------------------------------------------------- ====================== Part 6: BROWSE Command ====================== Overview of Questions --------------------- 1 I modified the structure of my database, but when I use the BROWSE command to view the file, I don't see the changes. How can I correct this problem? 2 When I press the CTRL+N key combination in my program to append a new record in the Browse window, I get the musical note instead. How can I correct this problem? ---------------------------------------------------------- Question 1 I modified the structure of my database, but when I use the BROWSE command to view the file, I don't see the changes. How can I correct this problem? Answer 1 You are most likely using the BROWSE command from the System menu or the View panel, or you are issuing a BROWSE LAST or BROWSE PREFERENCE command from the Command window. To see these structural changes, you must first issue a plain BROWSE command from the Command window to display the new default representation of the database. ---------------------------------------------------------- Question 2 When I press the Ctrl+N key combination in my program to append a new record in the Browse window, I get the musical note instead. How can I correct this problem? Answer 2 Ctrl+N is a shortcut key combination associated with the System menu. In your program, you must issue the SET SYSMENU ON command and/or use a BROWSE command instead of the BROWSE NOMENU command. ---------------------------------------------------------- ============================================= Part 7: Creating Applications and Executables ============================================= Overview of Questions --------------------- 1 I've created an application that doesn't allow me to edit my database files. How can I correct this problem? 2 Why can't I build an executable file from within my project? The options to do so are dimmed and unavailable. 3 When I attempt to build an executable file, I receive the error message "Link command failed." How can I correct this problem? 4 My executable file runs correctly under the development version, but I receive the error message "Feature not available" under the stand-alone version. How can I correct this problem? ---------------------------------------------------------- Question 1 I've created an application that does not allow me to edit my database files. How can I correct this problem? Answer 1 Mark your database as excluded in the project, then rebuild your application. You must distribute these files to your end users. Including the database in the project automatically makes these files read only. ---------------------------------------------------------- Question 2 Why can't I build an executable file from within my project? The options to do so are dimmed and unavailable. Answer 2 To build an executable file, you must purchase the Microsoft FoxPro Distribution Kit and install it in your FoxPro directory. Prior to installing the FoxPro Distribution Kit, make sure that the FoxPro files are not marked as read only. ---------------------------------------------------------- Question 3 When I attempt to build an executable file, I receive the error message "Link command failed." How can I correct this problem? Answer 3 If you receive this error message, check the following items: * Make sure that you have enough conventional memory. * Make sure that you have enough disk space. * Increase the number of file handles available to FoxPro. To do this, you can increase the FILES setting in the CONFIG.SYS file or increase the FILE HANDLES setting in the SHELL.CFG file. This is specific to Novell networks. * Make sure that FoxPro can find your COMMAND.COM file. * Make sure that the following files are on your path: WLINK8.EXE, and FOXSWAP.COM. * If you are running the 32-bit Extended Version of FoxPro, make sure that DOSMEM isn't set to ON in your CONFIG.FP file. For more information on DOSMEM, refer to "Customizing FoxPro" in the Installation and Configuration guide. ---------------------------------------------------------- Question 4 My executable file runs correctly under the development version, but I receive the error message "Feature not available" under the stand-alone version. How can I correct this problem? Answer 4 First, check the "Features Not Available" list in the FoxPro Distribution Kit documentation. Certain features used for development aren't available in the applications and executables you create. If you still encounter problems, it's possible that you're using macro substitution in your program. The recommended workaround is to set up a statement which causes the compiler to see the possible options for the macro-substituted commands so that they will be compiled into the .EXE file. For example: IF .F. MODIFY REPORT dummy MODIFY LABEL dummy ENDIF This code allows the compiler to see the MODIFY REPORT and MODIFY LABEL commands, but because it is never executed, the report and label names can be meaningless (dummy). ---------------------------------------------------------- ================ End of PSSQA.TXT ================