Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping in cursor file

Status
Not open for further replies.

hannec

Programmer
Mar 22, 2004
37
BE
Hello,

I have a button in a form. By clicking the button the program starts a scan-endscan of a cursor file.
Depending on the state of a record, the user has to do some input. The problem is that the scan does not stop to wait for the input.
It is a silly question, i know, but, any ideas?

VFP9 SP1

Thanks
 
Don't scan the entire cursor. Just skip up it until you find the next record that matches your condition. Then refresh the form, and come out of the method.

In other words, something like this:

SELECT TheCursor
SCAN WHILE the condition is not true
ENDSCAN

THISFORM.Refresh

Make sure you use a SCAN WHILE, not a SCAN FOR.

Each time the user clicks the button, he will see the next record that requires input. Once he's finished the input, he can click the button to go on. Provided he doesn't do anything else that moves the record pointer, this should work OK.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

thanks.

You are saying that the user has to push the button after every input. I was thinking that he pushes the button one time and the scan starts. The system evaluates each record and when a record needs input, the scan stopped and the user is giving the input. By saving the input, the user clicks a save-button, the scan is continuing.
The problem is that the scan does not stop and wait for the input.

Thank you for your time !

Hannec
 
Hannec,

But how would the user signal that he has finished the input?

To do the input, he would enter data into the fields on the form. He would then have to tell the form to scan up to the next record that requires input. However you write the code, the user would have to click the button, or do something similar.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

the user is entering data into the fields. After that he pushes the save-button and this is the sign to scan up to the next record. But the scan-endscan is not waiting.

Scan

record 1
record 2
record 3

record 4 : needs input - scan stops - user enter input and pushes button to go on

record 5
record 6
...

endscan

Is it to much to ask 'Please wait a moment and go on when i say so' ?

Hannec
 
Hannec,

OK, in that case, you need to put the scanning code in the Save button.

The code should first perform the save, and then scan up the cursor to the next record that needs user input. What I told you earlier is still valid -- the only issue is which button you put the code in.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hey guys,

with your help, it is working fine now.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top