If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Corel Paradox > Paradox code to open table for export within push button on form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-09, 09:37
ParaDi ParaDi is offline
Registered User
 
Join Date: Jul 2008
Posts: 6
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 09:46.
Reply With Quote
  #2 (permalink)  
Old 10-23-09, 17:05
Steve Green Steve Green is offline
Registered User
 
Join Date: Dec 2007
Posts: 282
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On