none
add record to table from variable

    Question

  •  

    Hello,

     

    I'm still learning VFP, so any help is appreciated....

     

    I've started with this simple code, I'm using the "GetFile" for the user to select the file and store the filename and Pathe to the Variable "File1"...that's were I'm stuck, I want to store the results of the variable into a table.  Later I will use the stored Paths to open files of the selected record in that table.

     

    =====================================

    Command button to store file name and Path....

     

    LOCAL file1 as String

     

    file1= GETFILE()

    MESSAGEBOX(file1)

     

    =====================================

    table name is: tblFilepaths

    Fields: FilePathID,fileDescr,filePath

     

     

    =====================================

    Command button to open file name and Path from the selected record, I might use a listbox....

     

    LOCAL file2 as String

    file2 = "C:\Report1.pdf" && this would not be hardcoded, but has to com from the *selected record in table

    MESSAGEBOX(file2)

     

     

    DECLARE INTEGER ShellExecute IN shell32.dll ;

    INTEGER hndWin, ;

    STRING cAction, ;

    STRING cFileName, ;

    STRING cParams, ;

    STRING cDir, ;

    INTEGER nShowWin

     

    cAction = "open"

    ShellExecute(0,cAction,file2,"","",1)

     

    =====================================

     

    Sunday, August 10, 2008 3:26 AM

Answers



  • CREATE CURSOR tblFilepaths(FilePathID I autoinc,fileDescr c(50),filePath c(100))
    LOCAL file1 as String

    file1= GETFILE()

    INSERT INTO tblFilePaths (fileDescr,filePath) values(JUSTFNAME(file1),FULLPATH(file1))

    LOCAL file2 as String

        file2 = tblFilePaths.filePath

    MESSAGEBOX(file2)

     

     

    DECLARE INTEGER ShellExecute IN shell32.dll ;
    INTEGER hndWin, ;
    STRING cAction, ;
    STRING cFileName, ;
    STRING cParams, ;
    STRING cDir, ;
    INTEGER nShowWin

     

    cAction = "open"

    ShellExecute(0,cAction,file2,"","",1)

    Sunday, August 10, 2008 9:00 AM
  •  ZiggyS wrote:

    I'm still learning VFP, so any help is appreciated....

     

    Do yourself a big favor and go to http://www.hentzenwerke.com/catalog/fund6.htm and get a copy of Fundamentals: Building Visual Studio Applications on a Visual FoxPro 6.0 Foundation. Although it is a few versions old, the concepts are still the same and this is the best beginner's reference that I have ever seen.

    Sunday, August 10, 2008 11:11 AM

All replies

  • well my persistance paid off, I figured it out, although it will need some error traps still...

     

     

     

    LOCAL file1 as String

     

    file1= GETFILE()

    MESSAGEBOX(file1)

     

    INSERT into tblFilepaths (filePath) VALUES (file1)

    thisform.Refresh

     

     

     

    ================================================================

     

     

     

    LOCAL file2 as String

     

     

    file2 =TBLFILEPATHS.filepath

    MESSAGEBOX(file2)

     

     

    DECLARE INTEGER ShellExecute IN shell32.dll ;

    INTEGER hndWin, ;

    STRING cAction, ;

    STRING cFileName, ;

    STRING cParams, ;

    STRING cDir, ;

    INTEGER nShowWin

     

    cAction = "open"

    ShellExecute(0,cAction,file2,"","",1)

    Sunday, August 10, 2008 5:24 AM


  • CREATE CURSOR tblFilepaths(FilePathID I autoinc,fileDescr c(50),filePath c(100))
    LOCAL file1 as String

    file1= GETFILE()

    INSERT INTO tblFilePaths (fileDescr,filePath) values(JUSTFNAME(file1),FULLPATH(file1))

    LOCAL file2 as String

        file2 = tblFilePaths.filePath

    MESSAGEBOX(file2)

     

     

    DECLARE INTEGER ShellExecute IN shell32.dll ;
    INTEGER hndWin, ;
    STRING cAction, ;
    STRING cFileName, ;
    STRING cParams, ;
    STRING cDir, ;
    INTEGER nShowWin

     

    cAction = "open"

    ShellExecute(0,cAction,file2,"","",1)

    Sunday, August 10, 2008 9:00 AM
  •  ZiggyS wrote:

    I'm still learning VFP, so any help is appreciated....

     

    Do yourself a big favor and go to http://www.hentzenwerke.com/catalog/fund6.htm and get a copy of Fundamentals: Building Visual Studio Applications on a Visual FoxPro 6.0 Foundation. Although it is a few versions old, the concepts are still the same and this is the best beginner's reference that I have ever seen.

    Sunday, August 10, 2008 11:11 AM
  • Thanks Surinder,

     

    I'll take a look later

     

    Ziggy

    Tuesday, August 12, 2008 10:57 PM
  • Thanks Marcia,

     

     

    I'll have a look, it's impossible to find books in the store...I have found some helpful links, but sometimes they're hard to come by

     

    Ziggy

    Tuesday, August 12, 2008 11:27 PM