Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: R K Sarkar
  Where is R K Sarkar?
 Secunderabad
 India
 R K Sarkar
 Tags
Subject: RE: append programme
Thread ID: 143524 Message ID: 143768 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Friday, August 31, 2007 1:55:06 PM         
   


> this is not called fixing. sometimes its not possible to explain exactly what i am looking for...atleast for me like a novice one. So taking guidance from experts is not wrong anywhere, I feel. Replying from your side is your own wish. However, this forum also needs experienced persons like you but knowledge should be blossomed with politeness and dignity.
>

RK

It is likely that Tamar did not notice your attachment at the bottom of the post. (I missed it the first time too and expected to see it arrive in my email.) When you attach a file to your post, it starts out at the bottom of the post, but most of us move it up to where we want it - certainly it should go before your signature. Tamar is quite correct - emailing a member with a request for help is considered very poor form unless specifically invited to do so.

As to your code. I will begin by recommending that you purchase this book:

http://www.hentzenwerke.com/catalog/fund6.htm

It was written for VFP 6, but even if you had upgraded to VFP 9, I would still recommend that book. The principles it provides give you the fundamentals that you need.

Open your form and take a look at where you put the code. All of your code is in the .Click() event. There is an old principle: Procedure code goes in methods - method calls go in events. Most of the code you have there should go into methods.

Next take a look at this code:

sele a
use Tcity

sele b 
use Tstate

sele c
use Tapp01

index on Tecod to xTecod


While there is nothing wrong with opening your tables programmatically, this code should more properly be placed in the .Load() rather than in a .Click(). Each time you click that button, it closes these tables and re-opens them. You can open the tables once at the beginning and then close them at the end.

If you do open your tables programmatically, the best way to do this is to do something like this:

IF NOT USED([MyTable])  && Check to see if the table is open and if not,
   USE MyTable IN 0 SHARED  && open it in the next available work area
ENDIF


Note the IN 0 SHARED clause in the USE command. If you open a table in work area 0, you don't have to SELECT A, SELECT B, etc.

Note your INDEX command. There are very few times when you should ever need to create an index at runtime. You should create your indexes when you create the table. Creating an index using the TO clause creates a non-structural simple index in an IDX file. You can create an index tag using the table designer and it will create that index as part of the structural CDX index file. The structural index is opened when you open the table so it will be kept current and you do not have to open the index explicitly with a SET INDEX command.

You do not have any control sources set, nor do you have table buffering enabled. Read the article that I gave you in my earlier post and give it a try. Come back here if you have any questions.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

append programme Posted by R K Sarkar @ 8/29/2007 3:05:46 PM
RE: append programme Posted by Ken Murphy @ 8/29/2007 3:23:29 PM
RE: append programme Posted by R K Sarkar @ 8/30/2007 9:45:48 AM
RE: append programme Posted by Ken Murphy @ 8/30/2007 1:47:49 PM
RE: append programme Posted by Tamar Granor @ 8/30/2007 10:33:48 PM
RE: append programme Posted by Ken Murphy @ 8/30/2007 10:40:21 PM
RE: append programme Posted by R K Sarkar @ 8/31/2007 10:13:34 AM
RE: append programme Posted by Ken Murphy @ 8/31/2007 1:55:06 PM
RE: append programme Posted by Tamar Granor @ 9/5/2007 11:44:51 PM
RE: append programme Posted by Arjun Bagojikop @ 8/30/2007 1:30:02 PM
RE: append programme Posted by Ulhas Amrite @ 8/31/2007 8:19:39 AM
RE: append programme Posted by R K Sarkar @ 8/31/2007 10:18:35 AM