Sorry guy, I lied to you earlier.
I see now that I did a cut and past of all your earlier commands into the command window and it only performed the last line that was "Browse". What I saw was the Product file. As soone as I noticed that the Product_ID was right, I thought all the code ran. The pointer was there because of the IndexSeek command I tried on the Product file that came back true put it there.
Now that I do the three lines of code one at a time I get the InvLinesCursor table open and it is blank. New hmmmm.
Based on that, should I still try this code?
>You're welcome...
>
>The ACTIVATE SCREEN command makes it so the "?" commands will output to the screen behind the form. It can be helpful...and less annoying than messageboxes.
>
>When you did the browse, you saw all of the invoiceLines? So the query works within VFP, but not within the form. hmmm.
>
>Well, next I would put the following in a separate .prg file, from within VFP. Then run the .prg file. Check the product table to see if it worked. You should also see output on the screen for each line that is being changed.
>
>Make sure the product table is open before you run the program.
>
>
>local lcInvoice_ID, lnCurrentSeason
>lnInvoice_ID = 31984
>
>lnCurrentSeason = 5
>
>activate screen
>set deleted on
>Select * from InvoiceDetail Where Invoice_ID = lnInvoice_ID ;
> into cursor InvLinesCursor
>? "Records selected: ",_tally
>select invLinesCursor
>scan
> if indexseek (InvLinesCursor.Product_ID, .t., 'product', 'product_id')
> * product found
> ? "updating product: ",invLinesCursor.Product_ID
> select product
> Replace UseSeason with lnCurrentSeason
> else
> * product not found...error processing here
> * referential integrity is supposed to prevent this
> ? "Error, product not found: ",invLinesCursor.Product_ID
> endif
>endscan
>
>
>Also (this is a sidebar), whenever you run your .exe you should probably issue a CLOSE DATA ALL command inside of VFP first, to make sure there aren't any multiuser issues.
>
>
>>That code in the command window worked and the record was at the right product.
>>
>>When I first took over this system from the guy who left the company I used "?" to help debug and it showed up on the form itself. I soon switch to messageboxes. The only time I get anything on the screen is when I enter things in the command window.
>>
>>The ShowWindow property of the form is "1 - In Top-Level Form".
>>
___________________________
Kenneth Wonderley
http://www.wonderley.com...the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness and self-control.
Galatians 5:22 & 23