Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 India
 tushar Kanvinde
 To: Dianne Benedicto
  Where is Dianne Benedicto?
 Davao City
 Philippines
 Dianne Benedicto
 Tags
Subject: RE: set relation to tables
Thread ID: 189283 Message ID: 189339 # Views: 2 # Ratings: 0
Version: Visual FoxPro 7 Category: Databases, Tables and SQL Server
Date: Thursday, August 14, 2008 1:19:18 PM         
   


> Hi all! Could anybody from you help me find out what's wrong with my code? I have 3 tables namely personal, entrance and studentsection. I need to display output from personal table(lastname, firstname, middlename); entrance table(sy,studentid,highschool,interest,dateofexam,dat,descdat,pnlt,desc_pnlt,olmat,desc_olmat,raven,desc_raven) and lastly from student section table(sectioncode). They have primary keys: studentid.
>
> sele personal
> set order to tag id
> sele entrance
> SET orde to studentid
> SELECT studentsection
> SET ORDER TO sectioncod
> seek ALLTRIM(thisform.cSection.value)
> set relation to studentid INTO entrance
> tempfile=sys(3)+'.dbf'
> copy to (tempfile) while ALLTRIM(sectioncode)=ALLTRIM(thisform.cSection.value) fields studentsection.sectioncode,;
> entrance.sy,entrance.studentid,entrance.highschool,;
> entrance.interest,entrance.dateofexam,entrance.dat,entrance.descdat,;
> entrance.pnlt,entrance.desc_pnlt,entrance.olmat,entrance.desc_olmat,;
> entrance.raven,entrance.desc_raven,personal.religion,entrance.remark,;
> personal.lastname, personal.firstname,personal.middlename,;
>
> sele 0
> use (tempfile)alias temp
>
> sele temp
> index on lastname + firstname + middlename tag tempo
>
> REPO form c:\guidance\reports\section.frx for (temp->sy)= thisform.txtschoolyr.value and alltrim(temp->sectioncode) =thisform.cSection.value) prev
>
> use
> erase (tempfile)
> tempfile=stuff(tempfile, at('.', tempfile),4,'cdx')
> erase (tempfile)
>
> But after running my form, there's no record found. What's wrong? Please help me. Thanks.

Dianne

You are not setting any relation into personal.

the alltrim(temp->sectioncode) =thisform.cSection.value will create a shorter string on the left in which case it will always be .f. This condition does not seem to be required since it is already taken care of in the WHILE clause of the COPY command.

Also since you are not using all the records for the report, you could ignore them in the copy command itself

copy to (tempfile) while ALLTRIM(sectioncode)=ALLTRIM(thisform.cSection.value) for entrance.sy=thisform.txtschoolyr.value

It would be better to create a cursor with SELECT SQL instead. In that case you don't have to worry about deleteing it after you have no use of it.

Regards
Tushar

ENTIRE THREAD

set relation to tables Posted by Dianne Benedicto @ 8/14/2008 9:13:34 AM
RE: set relation to tables Posted by Anil Sharma @ 8/14/2008 9:29:59 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/14/2008 9:49:04 AM
RE: set relation to tables Posted by Anil Sharma @ 8/14/2008 11:20:29 AM
RE: set relation to tables Posted by surinder singh @ 8/14/2008 10:05:26 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/14/2008 10:11:02 AM
RE: set relation to tables Posted by Stefan Wuebbe @ 8/14/2008 10:29:08 AM
RE: set relation to tables Posted by Anil Sharma @ 8/14/2008 11:18:33 AM
RE: set relation to tables Posted by tushar @ 8/14/2008 1:19:18 PM
RE: set relation to tables Posted by Anders Altberg @ 8/14/2008 2:09:54 PM
RE: set relation to tables Posted by Dianne Benedicto @ 8/20/2008 5:00:49 AM
RE: set relation to tables Posted by Anders Altberg @ 8/20/2008 11:23:41 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 5:43:17 AM
RE: set relation to tables Posted by Anders Altberg @ 8/26/2008 11:06:13 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/27/2008 2:17:21 AM
RE: set relation to tables Posted by Glenn Villar @ 8/15/2008 7:40:57 AM
RE: set relation to tables Posted by tushar @ 8/15/2008 7:52:31 AM
RE: set relation to tables Posted by Glenn Villar @ 8/15/2008 7:56:35 AM
RE: set relation to tables Posted by Ulhas Amrite @ 8/27/2008 10:53:24 AM
RE: set relation to tables Posted by tushar @ 8/27/2008 4:53:58 PM
RE: set relation to tables Posted by Dianne Benedicto @ 8/20/2008 4:47:13 AM
RE: set relation to tables Posted by Glenn Villar @ 8/20/2008 6:16:51 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 5:41:39 AM
RE: set relation to tables Posted by Glenn Villar @ 8/26/2008 6:02:59 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 7:40:42 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 7:44:25 AM
RE: set relation to tables Posted by Glenn Villar @ 8/26/2008 8:17:51 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 8:46:57 AM
RE: set relation to tables Posted by tushar @ 8/26/2008 9:25:42 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 9:31:54 AM
RE: set relation to tables Posted by Glenn Villar @ 8/26/2008 9:39:58 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 9:55:15 AM
RE: set relation to tables Posted by Glenn Villar @ 8/26/2008 10:00:37 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/26/2008 10:08:17 AM
RE: set relation to tables Posted by Glenn Villar @ 8/26/2008 10:34:24 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/27/2008 10:41:48 AM
RE: set relation to tables Posted by Anders Altberg @ 8/26/2008 4:35:37 PM
RE: set relation to tables Posted by Dianne Benedicto @ 8/27/2008 2:18:53 AM
RE: set relation to tables Posted by Stefan Wuebbe @ 8/27/2008 7:54:29 AM
RE: set relation to tables Posted by Dianne Benedicto @ 8/27/2008 10:43:17 AM