I had changed some code and now it is not giving a run time error.
The filter is set. But it is not properly refreshed. I don't know why!? Since I am not using data bound grid, I could not find out the problem. Let us probe and find out...
Code: Select all
#include <hmg.ch>
Function Main
*--------------------- 1 base
if !file("b1cus.dbf")
DBCREATE("b1cus" , { {"CUS_NUM" , "C", 6 , 0},;
{"CUS_NAME" , "C", 30 , 0} },, .T., "")
endif
sele a
Use b1cus
if lastrec()<1
appe blank
repl CUS_NUM with 'cus 1', CUS_NAME with 'customer AAAAAA'
appe blank
repl CUS_NUM with 'cus 2', CUS_NAME with 'customer BBBBBB'
appe blank
repl CUS_NUM with 'cus 3', CUS_NAME with 'customer CCCCCC'
endif
*--------------------- 2 base
if !file("b2inv.dbf")
DBCREATE("b2inv" , { {"INV_NUM" , "C", 6 , 0},;
{"INV_CUS" , "C", 6 , 0},;
{"INV_DATE" , "N", 9 , 2} },, .T., "")
endif
sele b
Use b2inv
if lastrec()<1
appe blank
repl INV_NUM with 'inv 1', INV_CUS with 'cus 1', INV_DATE with 123456.89
appe blank
repl INV_NUM with 'inv 2', INV_CUS with 'cus 3', INV_DATE with 222222.22
appe blank
repl INV_NUM with 'inv 3', INV_CUS with 'cus 1', INV_DATE with 333333.33
appe blank
repl INV_NUM with 'inv 4', INV_CUS with 'cus 3', INV_DATE with 444444.44
appe blank
repl INV_NUM with 'inv 5', INV_CUS with 'cus 2', INV_DATE with 555555.55
appe blank
repl INV_NUM with 'inv 6', INV_CUS with 'cus 2', INV_DATE with 666666.66
endif
*--------------------- 3 base
if !file("b3det.dbf")
DBCREATE("b3det" , { {"DET_INV" , "C", 6 , 0},;
{"DET_PRO" , "C", 30 , 0},;
{"DET_QTY" , "N", 3 , 0},;
{"DET_PRI" , "N", 6 , 2} },, .T., "")
endif
sele c
Use b3det
if lastrec()<1
appe blank
repl DET_INV with 'inv 1', DET_PRO with 'product AAAAAAAA', DET_QTY with 999, DET_PRI with 123.56
appe blank
repl DET_INV with 'inv 1', DET_PRO with 'product BBBBBBBB', DET_QTY with 111, DET_PRI with 987.54
appe blank
repl DET_INV with 'inv 1', DET_PRO with 'product CCCCCCCC', DET_QTY with 999, DET_PRI with 123.56
appe blank
repl DET_INV with 'inv 2', DET_PRO with 'product BBBBBBBB', DET_QTY with 111, DET_PRI with 987.54
appe blank
repl DET_INV with 'inv 2', DET_PRO with 'product CCCCCCCC', DET_QTY with 999, DET_PRI with 123.56
appe blank
repl DET_INV with 'inv 3', DET_PRO with 'product ZZZZZZZZ', DET_QTY with 111, DET_PRI with 987.54
appe blank
repl DET_INV with 'inv 3', DET_PRO with 'product XXXXXXXX', DET_QTY with 999, DET_PRI with 123.56
appe blank
repl DET_INV with 'inv 1', DET_PRO with 'product CCCCCCCC', DET_QTY with 999, DET_PRI with 123.56
appe blank
repl DET_INV with 'inv 4', DET_PRO with 'product BBBBBBBB', DET_QTY with 111, DET_PRI with 987.54
appe blank
repl DET_INV with 'inv 4', DET_PRO with 'product CCCCCCCC', DET_QTY with 999, DET_PRI with 123.56
appe blank
repl DET_INV with 'inv 5', DET_PRO with 'product ZZZZZZZZ', DET_QTY with 111, DET_PRI with 987.54
appe blank
repl DET_INV with 'inv 6', DET_PRO with 'product XXXXXXXX', DET_QTY with 999, DET_PRI with 123.56
endif
*--------------------------------------
Load Window Main
Load Window form_3grids
Main.Center
Activate Window All
Return
*--------------------------------------------
*--------------------------------------------
*--------------------------------------------
proc p_quit()
quit
retu
*--------------------------------------------
*--------------------------------------------
*--------------------------------------------
proc p_open_form_3grids()
form_3grids.Grid_2.EnableUpdate()
form_3grids.show
retu
*--------------------------------------------
*--------------------------------------------
*--------------------------------------------
proc p_close_form_3grids()
sele b
set filter to
go bottom
go top
form_3grids.Grid_2.refresh
form_3grids.hide
retu
*--------------------------------------------
*--------------------------------------------
*--------------------------------------------
proc p_grid1_dbl_cli()
*---- 1 reading the value from the database
n_row := form_3grids.Grid_1.Recno
sele a
goto n_row
*---- 2 Information aboth the selected customer
form_3grids.Label_1.Caption := a->cus_num + ' selected...'
sele b
*---- 3 Re-activatng the filter
set filter to b->INV_CUS == a->cus_num
go top
form_3grids.Grid_2.refresh
retu
*--------------------------------------------
*--------------------------------------------
*--------------------------------------------