Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Eddie Ruiz
  Where is Eddie Ruiz?
 Hawthorne
 United States
 Eddie Ruiz
 To: Kulwant Singh
  Where is Kulwant Singh?
 Shimla
 India
 Kulwant Singh
 Tags
Subject: RE: Help on exporting data from a form to ex
Thread ID: 394107 Message ID: 394138 # Views: 28 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Monday, December 30, 2013 9:35:19 PM         
   


> > Hello I need some help on exporting data from a dbf to excel. I created a form to make it easier for the user to export data by choosing a selected date range. Below is the code that's in the click event button on the form. Since Im only getting data from 1 dbf in the form (please see screenshot attached) on the first textbox I want to be able to have the user input their choice of customer number (is a 4 digit number, example:L 1155, 2015, etc...)and export the data from that customer by the date range selected. I cant figure out how to accomplish this to filter and export by what the user typed in the first textbox.
> >
> > Thanks in advanced.
> >
> > LOCAL ldStartdate, ldEnddate
> > ldStartdate = thisform.startdatetextbox.value
> > ldEnddate = thisform.enddatetextbox.value
> > ldcustomer = thisform.customertextbox.value
> > * verify values
> > If NOT vartype(ldStartdate)+Vartype(ldEnddate)=="DD"
> > Messagebox("wrong date entry")
> > Return
> > Endif
> > If ldEnddate> > Messagebox("wrong date range")
> > Return
> > ENDIF
> >
> >
> > COPY FIELDS 1.cus, 1.cusname, 1.transdate, ;
> > 1.transnum, 1.checknum, 1.tranpaid to c:\documents\test.xls type xl5 ;
> > for BETWEEN(transdate, m.ldStartdate, m.ldenddate) AND ;
> > CHRTRAN(transnum, CHRTRAN(transnum, "0123456789", ""), "") == transnum AND (cus = ldcustomer)
> >
> >
> >
> > thisform.release
> >
> >
>
> try this
>
>
select cus, cusname, transdate, transnum, checknum, tranpaid ;
> from YOURTABLE ;
> WHERE transdate >= m.ldStartdate AND transdate <=  m.ldenddate AND (..MORE CONDITIONS ...);
> INTO CURSOR TEMP
> 
> SELECT TEMP
> COPY TO c:\documents\test.xls type xl5 

>
>
>
>
> > for BETWEEN(transdate, m.ldStartdate, m.ldenddate) AND ;
> > CHRTRAN(transnum, CHRTRAN(transnum, "0123456789", ""), "") == transnum AND (cus = ldcustomer)
>
> kulwant
> (Help Save the TIGER. Save Wildlife. Live & let Live)

Thank You soo much, it worked. Now i have another quick question is there a way that when exporting the transdate gets sorted from newest date to oldest?

ENTIRE THREAD

Help on exporting data from a form to ex Posted by Eddie Ruiz @ 12/30/2013 6:11:39 PM
RE: Help on exporting data from a form to ex Posted by Kulwant Singh @ 12/30/2013 8:12:17 PM
RE: Help on exporting data from a form to ex Posted by Eddie Ruiz @ 12/30/2013 9:35:19 PM
RE: Help on exporting data from a form to ex Posted by Koen Piller @ 12/30/2013 9:54:11 PM
RE: Help on exporting data from a form to ex Posted by Stefan Wuebbe @ 12/30/2013 10:24:50 PM