Ernesto_Paez
MIS
Hi everyone,
Just still experimenting, here i have a code in a search command where i can type a job no and then display all records in grid that have similar draw_no and ball_nos but if for any reason there is a record where the part_no is identical to another record too, "then this is a duplicated record", then i would like to hilite this row by using "DynamicBackColor" in that grid row or dynamic Forecolor , so when the user look into the GRID results, they can realize the actual duplicate record.
can you help here ?
notice, that i have added code for hilite alternate records as well.
below is a pic of a two records that are identical at the bottom of the grid, so those should be the one shown in a different color or background.
here is the code i used
thanks in advance
Just still experimenting, here i have a code in a search command where i can type a job no and then display all records in grid that have similar draw_no and ball_nos but if for any reason there is a record where the part_no is identical to another record too, "then this is a duplicated record", then i would like to hilite this row by using "DynamicBackColor" in that grid row or dynamic Forecolor , so when the user look into the GRID results, they can realize the actual duplicate record.
can you help here ?
notice, that i have added code for hilite alternate records as well.
below is a pic of a two records that are identical at the bottom of the grid, so those should be the one shown in a different color or background.
here is the code i used
Code:
Local lcJob_no
Set Safety Off
Set Cpdialog Off
Set Exclusive Off
lcJob_no= Thisform.txtTextBox.Value
Select draw_NO As OrigDrawno, draw_NO, ball_no, part_no From c:\mfg\eng_jobs Where job_no=lcJob_no Into Cursor junk Readwrite
Replace draw_NO With Alltrim(Str(Val(draw_NO))) For !"X"$draw_NO In junk
Select j1.OrigDrawno, j2.X, j1.draw_NO, j1.ball_no, j2.part_no, j2.xcount ;
FROM junk j1,;
(Select draw_NO,ball_no,draw_NO+" "+ball_no As X, part_no, Count(draw_NO+ball_no) As xcount;
FROM junk;
GROUP By 1,2,3,4 ;
HAVING Count(draw_NO+ball_no) > 1 ) j2 ;
WHERE j1.draw_NO=j2.draw_NO And j1.ball_no=j2.ball_no;
ORDER By X;
Into Cursor RESULTS2
If _Tally > 0
With Thisform.grid2
.Visible = .T.
.ColumnCount = -1
.RecordSource = 'RESULTS2'
.SetAll("DynamicBackColor", ;
"IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) , RGB(0,255,0))", "Column")
** so i added the below, thinking that i can get the duplicated exact records and
** change the Forecolor for them.
.SetAll("DynamicForeColor", ;
"IIF(Count(draw_NO+ball_no+part_no)>1, RGB(255,0,0) , RGB(0,255,0))", "Column")
.Refresh()
Endwith
Thisform.buttonx1.Enabled =.T.
Thisform.Sstoexcel21.Enabled=.T.
Thisform.command3.Enabled= .T.
Thisform.command4.Enabled=.T.
Thisform.command2.Enabled=.T.
Thisform.command1.Enabled= .F.
Else
Messagebox('There is not result for your Query, Check again your Part No. Entry',0+64,'Ok!')
Thisform.command1.Enabled= .F.
Thisform.command3.Enabled=.F.
Thisform.command4.Enabled=.F.
Thisform.command2.Enabled=.T.
Thisform.txtTextBox.Value=''
Thisform.txtTextBox.SetFocus
With Thisform.grid2
.Visible = .F.
.ColumnCount = -1
.RecordSource = 'resultd'
Endwith
Endif