Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2008
    Posts
    6

    Unanswered: Paradox code to open table for export within push button on form

    I want to export information from a query that requests a begin and end date from within a form push button so the user can export the results to Excel for data analysis and charting. I don't know how to run the query and leave the answer table open for the user. I also plan to save the table to another name but wanted to keep it simple until I solve the open problem.

    I inherited Paradox from a deceased developer a few years ago and we are no longer developing in Paradox but still running this legacy application. I only get into this Paradox app when something is broken or they seriously need data. Thus, the need to send the data to Excel. I thought I could reuse the code for a parameter report where the user enters a date range and the report spits out for them. This user is so naive, she messes up the query when she enters dates, so I'm trying to make it as easy as possible for her. I'm not even sure if she will be capable of the export, but I thought I might be able to automate that within Excel for her.


    Here's the code I have - anything better is welcome.

    method pushButton(var eventInfo Event)
    var
    tblName String
    tblCur TCursor
    yesVar String
    fSt String
    fDt Date
    lSt String
    lDt Date
    tblVar Table
    qryName Query
    endVar

    tblName = ":PRIV:ANSWER.DB"
    yesVar = msgQuestion("Performance Query",
    "Do you want to continue with query by date range?")


    switch
    case yesVar = "Yes" :

    fSt = "For example: 1/1/09"
    fDt = today()
    lSt = "For example: 12/31/09"
    lDt = today()
    fSt.view("Enter first date of query like 01/01/09")
    if fSt <> "For example: 01/01/09" then
    fDt = date(fSt)
    lSt.view("Enter Last date of query like 12/31/09")
    if lSt <> "For example: 12/31/09" then
    lDt = date(lSt)
    endif
    endif
    qryName = Query

    EAP_NAME.DB | Last Name, First MI |
    | join1 |
    EAP_NAME.DB | Contact Date | Chart # |
    | Check _join2 | Check | Check |

    EAP_DATE.DB | Last Name, First MI |Contact Date |
    | join1 | Check _join2 | >=~fDt, =~lDt |

    EndQuery

    if executeQBE(qryName, tblName) then
    if isTable(tblName) then
    tblCur.open(tblName)
    if NOT tblVar.isEmpty() then
    tblCur.edit() tblCur.postRecord()
    tblCur.endEdit() tblCur.open(tblName)
    else
    errorShow()

    tblCur.open(tblName)


    endif
    endif
    case yesVar = "No" :
    endSwitch
    endmethod
    Last edited by ParaDi; 10-23-09 at 10:46.

  2. #2
    Join Date
    Dec 2007
    Posts
    366
    not really knowing your overall OPAL knowledge or capabilities, my first suggestion would be to check Dateval() of the user's response.. then, after both inputs, make sure the second one is a later date than the first one..
    --
    Steven Green - Myrtle Beach, South Carolina USA

    http://www.OasisTradingPost.com

    Oasis Trading Post
    - Collectibles and Memorabilia
    - Vintage Lego Sets and Supplies
    - and Paradox Support, too

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •