Hi John,
You could add a method to your form called CreateReportCursor(). In that put the following code: (this is off the top of my head so it's a best guess)
LOCAL cGroupCode, cCompanyName, dStart, dEnd
WITH THISFORM
cGroupCode = .textbox1.VALUE
cCompanyName = .textbox2.VALUE
dStart = .textbox3.VALUE
dEnd = .textbox4.VALUE
ENDWITH
SELECT client.groupcode, PAYMENT.companyname, PAYMENT.startdate, PAYMENT.enddate ;
FROM client, PAYMENT ;
WHERE client.groupcode = cGroupCode ;
AND PAYMENT.companyname = cCompanyName ;
AND PAYMENT.startdate >= dStart ;
AND PAYMENT.enddate <= dEnd ;
INTO CURSOR ReportPreview
IF _TALLY != 0
cReturn = .T.
ELSE
cReturn = .F.
ENDIF
RETURN cReturn
Then in the click event of your button put
cResult = thisform.CreateReportCursor()
if cResult
wait window 'Cursor is there, do your preview'
else
wait window 'No records, notify the user'
endif
BTW, you may want to give you text boxes meaninful names. Your code will be alot clear with .txtGroupName instead of .TextBox1
Also look here on the UT for the book Jim Booth and Steve Sawyer wrote called 'Effictive Techniques for application development with visual foxpro' it is awesome. Click the UTPP link in the left frame to find it.
hth
>Hi Roi,
>As you can see I'm a newbe. But thanks to you guys help the lights are starting to go on. Roi I think I understand what you are saying, but could you expand ? What I have are two tables, one Client the other payments.
>What I am trying to do is allow the user to enter data in a form. the information is as follows: Client.groupcode in textbox1, a Payment.companyname in textbox2, a payment.startdate in textbox3 and a Payment.enddate in textbox4. If found report payment preview, if not found say "Data Condations Not Found". I feel I almost understand what you guys are saying, but the light haven't gone on yet. I feel if I had a sample of code I could take it apart and better understand it. I hope I'm not breaking any rules, by asking too long or the wroung questions but I can't afford classes and really want to learn. Going Visual is a new world to me. I have three good books that I use. Microsofts Visual Foxpro 6.0 Programs Guide,Using Visual Foxpro 6 Special Edition by Menachem and Hacker's Guide to Visual Foxpro 6.0. I guess the only thing I'm missing is VFP6.0 for dummies. If anyone can point me in the right direction, the Gods will surely smile on you.
>
>THANKS aGAIN
>John
Roi
'MCP' Visual FoxPro
In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!