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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browse table and edit two fields only 1

Status
Not open for further replies.

SuperBob

Technical User
Sep 18, 2001
23
GB
I have been asked to change a program used in Foxpro 6.0 but clearly written in an earlier version. It contains the following code which displays some fields from a table, and allows one field (goods_in) only to be edited. I need to make the cost_price editable as well, but it seems I cannot use the FREEZE option for two fields. How can I allow the TWO fields to be edited, but none of the others?

A follow-up question: if cost_price can be changed, would the calculated field "totcost" be automatically updated?


BROWSE LAST NORMAL NOAPPEND NODELETE NOMENU TITLE "Suggested Orders" ;
FIELDS ;
supplier:18, ;
part_no:12 :H = 'Our Part', ;
sup_part:12 :H = 'Their Part', ;
desc:25 :H = 'Description', ;
stock:8, ;
on_order:8 :H = 'Ordered', ;
min_stock:7 :H = 'Min', ;
max_stock:7 :H = 'Max', ;
goods_in:8:H='Suggest':v=goods_in>-1:E='Suggestion Less Than Zero',;
cost_price:10 :H = 'Unit Cost', ;
totcost = goods_in*cost_price:10 :H = 'Total' ;
FREEZE goods_in
RETURN

Thanks in advance.
 
A ':R' marks columns as read only...

brow field sup_part:12 :R :H = 'Their Part'

See 'BROWSE command' in help.

Brian
 
Another alternative to Brians solution is to use.. (since you may not want to even allow the cursor to stay in those unwanted fields)...

:W=.T. to allow editig
:W=.f. to deny the field positioning itself.

OR
for example...
I=0
BROWSE LAST NORMAL NOAPPEND NODELETE NOMENU TITLE "Suggested Orders" ;
FIELDS ;
supplier:18:W=I>0, ;
part_no:12 :H = 'Our Part':W=I>0, ;
sup_part:12 :H = 'Their Part':W=I>0, ;
desc:25 :H = 'Description':W=I>0, ;
stock:8:W=I>0, ;
on_order:8 :H = 'Ordered':W=I>0, ;
min_stock:7 :H = 'Min':W=I>0, ;
max_stock:7 :H = 'Max':W=I>0, ;
goods_in:8:H='Suggest':v=goods_in>-1:E='Suggestion Less Than Zero',;
cost_price:10 :H = 'Unit Cost', ;
totcost = goods_in*cost_price:10 :H = 'Total':W=I>0 ;

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Hey Ramani! Good to see you back here. [smile]

boyd.gif

SweetPotato Software Website
My Blog
 
Hi creig. Good to see you and good to visit back Tektips. And glad to see the experts team here almost intact.

For those who only know my sudden absence for almost over an year... I had some consistent health problem and after 5 or 6 months intermitant medical checks, identified as having three heart blocks of over 85%. I could have had a massive attack at those conditions. It is just a miracle that I did not get any. I underwent angioplasty and walked out of the hospital comfortably. But the aftermath left me very weak and hardly able to do my routine work. Thus my absence to visit here, though at times I sneaked in, driven by my affinity to this site. Now that I am getting much better, I will soon be back. I will be again out to my home country after a week - for more medical checks, visit my parents etc. and will be back to my work place after a month. I am almost OK now and will soon be back to Tektips with a gradual increasing presence (after my return). Atleast I hope so.

I dont want this to be a personal column with my messages, but I felt I owed an explanation for my absence here, especially when I get a nice message from craig.

I have to soon catchup with the good threads here. And in the process be helpful to others to the best of my abilities.

Cheers. :)

____________________________________________
ramani - (Subramanian.G) :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top