Now I really don't understand this.
There is no change to the product file. I see no printed message either.
I thought maybe the form hid the messages, so, I put message boxes right before the messages and they do not display.
I added message boxes just before the Select and the Scan commands and both of those display. I have verfied that the invoice number is right. (31984)
>Okay, put this code in that same commandButton click() (replacing what you currently have in there). Hard code the invoice_ID on the second line. Run the form and click the button (you know the drill *grin*). Don't add any commands for buffering at this point. If you don't get any errors, manually open product table and make sure it worked.
>
>
>local lcInvoice_ID, lnCurrentSeason
>lnInvoice_ID = 12345
>
>lnCurrentSeason = 5
>
>activate screen
>set deleted on
>Select * from InvoiceDetail Where Invoice_ID = lnInvoice_ID ;
> into cursor 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
>
>
>As far as running the form without compiling, it can save you some time and trouble. You should be able to have a small program that creates the necessary variables and runs the form.
>
>It sounds like the system may have some global variables, which can be quite troublesome. But, that is another topic...
>
>
>
>>Done, it worked just fine too. Both records changed, no errors.
>>
>>I have not set a break point and I don't really know how.
>>I suspect to do that you have to run the form interactively.
>>I've never been able to do that. I always have to build and run the exe file.
>>If I try to run the main screen directly I get the error.
>>"Variable STARTDIRECTORY not found."
>>The creator of this sytem does all sorts of stuff with an INI file.
>>It may have to do with that.
>>I could probably create some variables first and then run the main form interactively.
>>
>>>Okay, try it again with the change below (to change 2 records).
>>>
>>>When your code crashes, does it error out on the first line of the invoice detail? Have you set a breakpoint in your form and stepped through it in the debugger?
>>>
>>>>That did update the first record of the Product file fine.
>>>>BTW - UseSeason is numeric.
>>>>
___________________________
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