How to Convert Picture Fields to General Fields

Last reviewed: May 17, 1996
Article ID: Q110253
The information in this article applies to:
  • Microsoft FoxPro for Macintosh, version 2.5b

SUMMARY

FoxBASE+ for Macintosh picture fields must be converted to general fields before they can be viewed in FoxPro for Macintosh. Although the FB+Migration application (FoxPro:Goodies:FB+Migrate:FB+Migrate.App) converts FoxBASE+/Mac picture fields to general fields, you may prefer to perform this operation programmatically, as described below.

MORE INFORMATION

The following code shows how to convert a FoxBASE+/Mac database with a picture field to a FoxPro database with a general field. NOTE: This program can be run only in FoxPro for Macintosh.

   CLOSE DATABASES
   * Prompt for Database to convert
   filename=GETFILE("DBF","Please locate your FoxBase+ database:")
   * Be sure user has selected a database to convert
   IF EMPTY(filename)
      WAIT WINDOW ;
        "No Database Selected to Convert--program terminated" NOWAIT
      RETURN
   ENDIF
   * Open selected database
   USE (filename)
   basename=ALIAS()
   COPY STRUCTURE EXTENDED TO temp
   SELECT B
   USE temp
   LOCATE FOR field_type="P"
   IF NOT FOUND()
      WAIT WINDOW "No picture fields found--program terminated" NOWAIT
      USE
      DELETE FILE temp.dbf
      RETURN
   ENDIF
   DO WHILE FOUND()
      REPLACE field_type WITH "G"
      CONTINUE
   ENDDO
   SELECT field_name FROM temp ;
     WHERE field_type="G" INTO ARRAY fieldlist
   USE
   * Prompt for name of converted database
   fpmgen=PUTFILE("Enter new database name:","PICTURE.DBF","DBF")
   IF EMPTY(fpmgen)
      WAIT WINDOW ;
        "No New Filename Selected--program terminated" NOWAIT
      RETURN
   ENDIF
   CREATE (fpmgen) FROM temp
   DELETE FILE temp.dbf
   APPEND FROM (filename)
   GO TOP
   DO WHILE NOT EOF()
      FOR x=1 TO ALEN(fieldlist)
         APPEND GENERAL (fieldlist(x)) ;
           FROM MEMO (basename+"."+fieldlist(x))
      ENDFOR
      SKIP
      SKIP IN (basename)
   ENDDO


Additional reference words: FoxMac 2.50b migrate pict general foxbase
convert
KBCategory: kbprg kbcode
KBSubcategory:


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 17, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.