Its the LOCATE that causes the problem use a SELECT like I suggested to you.
Eamil I sent you.
If you change the LOCATE to a SELECT then it gets you around the problem.
I don’t want to tell you how to write it but I would look at using a checkbox to allow selection of each record within the grid. This allows the user to be far more aware of what they are doing (un-checking it removes it form the second grid), if they currently select the wrong record in the grid then it automatically adds it anyway.
What are the values of d1,d2,d3,d4,d5 and d6? Where are they stored? You can simply update sum1 as below but you need to get the values for the d’s from somewhere.
Hope this helps a bit.
Jon
LPARAMETERS nColIndex
thisform.text3.value=THISFORM.GRID2.column1.text1.VALUE
SELECT * FROM temp WHERE ALLTRIM(UPPER(typ)) = ALLTRIM(UPPER(THISFORM.GRID2.column1.text1.VALUE)) INTO ARRAY laResults
*LOCATE FOR temp.typ=THISFORM.GRID2.column1.text1.VALUE
*LOCATE FOR NAM1=THISFORM.TEXT3.VALUE
*IF !FOUND()
IF _TALLY = 0
SELECT temp
APPEN BLANK
REPLACE temp.typ WITH THISFORM.GRID2.column1.text1.VALUE
REPLACE temp.sum1 WITH (d1+d2+d3+d4+d5+d6)
GO TOP
thisform.grid1.refresh
ELSE
=MESSAGEBOX("found.....")
endif
>hi,
>itry as under but still if i choice e.x from mygrid2(io2),
>i see at mygrid1 io1 and io2.
>
>LPARAMETERS nColIndex
>thisform.text3.value=THISFORM.GRID2.column1.text1.VALUE
>? thisform.text3.value
>lcType = TRIM(UPPER(THISFORM.text3.VALUE))
>? lcType
>SELECT 3
>*USE temp IN 0
>LOCATE FOR TYP = lcType
>IF !FOUND()
> APPEN BLANK
> REPLACE TYP WITH lcType in TEMP
> GO top
> thisform.grid1.refresh
>ELSE
> =MESSAGEBOX("found.....")
>endif
>
>>M
>>
>>Assuming the table (MyTable) in your source grid is current, i.e. the selected table, then you can say:
>>
>>
>>LPARAMETERS nColIndex
>>
>>lcType = MyTable.TypeField
>>Select Temp
>>LOCATE FOR TYP = lcType
>>IF !FOUND()
>> APPEN BLANK
>> REPLACE TYP WITH lcType in TEMP
>> GO top
>> thisform.grid1.refresh
>>ELSE
>> =MESSAGEBOX("found.....")
>>endif
>>
>>
>>Terry
>>
>>
>>>hi all,
>>>
>>>i need help to insert item (evrey time one item only) from grid2 to grid1
>>>i try via this code under.
>>>but this code get all items form grid2 and replacement to grid1
>>>
>>>but i need to replace one item after i make choice
>>>i try ==,
>>>i try set exact on,
>>>and set near off,
>>>and upper,alltrim
>>>same result ...
>>>
>>>
>>>LPARAMETERS nColIndex
>>>LOCATE FOR temp.typ=THISFORM.GRID2.column1.text1.VALUE
>>>IF !FOUND()
>>> SELECT 3
>>> APPEN BLANK
>>> REPLACE temp.typ WITH THISFORM.GRID2.column1.text1.VALUE
>>> GO top
>>> thisform.grid1.refresh
>>>
>>>ELSE
>>> =MESSAGEBOX("found.....")
>>>endif
>>>
>>>
>>>thanks.