Hi Sergey:
I added one more field to the rev_locations table. This field will generate a unique numeric value each time a new record is added to the table.
I thought that this might be an easier way of deleteing a record that has been clicked in the grid.
Here's my code.
**********************
CLICK EVENT OF _GRID1
mprimedelete = ""
mseconddelete = ""
mlocid = 0
If !thisform._grid2.visible
mprimedelete = EVAL(thisform._grid1.column1.text1.controlsource)
mseconddelete = EVAL(thisform._grid1.column2.text1.controlsource)
mlocid = eval(thisform._grid1.column3.text1.controlsource)
else
mprimedelete = EVAL(thisform._grid2.column1.text1.controlsource)
mseconddelete = EVAL(thisform._grid2.column2.text1.controlsource)
mlocid = eval(thisform._grid2.column3.text1.controlsource)
endif
The above code goes into Column2 and 3, Text1 respectively of grid1.
**********************
DELETE BUTTON - CLICK EVENT
DELETE FROM rev_locations;
WHERE rev_locations.locationid = mlocid
close tables
use rev_locations exclusive
pack
close tables all
thisform.load()
thisform._grid1.recordsource = "revlocinfo"
thisform._grid1.column1.header1.caption = "Primary Location"
thisform._grid1.column2.header1.caption = "Secondary Location"
thisform._grid1.column3.header1.caption = "Location ID"
thisform._grid1.column1.width = 161
thisform._grid1.column2.width = 198
thisform._grid1.refresh()
select distinct primaryloc, locationid from rev_locations into cursor primaryinfo nofilter;
order by rev_locations.primaryloc
thisform._combobox1.rowsource = "primaryinfo"
***************************
PROBLEM:
I am able to delete a record the first time around, after which the grid is repopulated to display the current contents of the table. If I click any of the rows, and do a ?mlocid in the command window, I do not get the value of the "Location ID" column in the grid, rather just a zero. In summary, the delete works fine for the first time around, but nothing happens if i choose another cell in the grid and try to delete it. Appears that the Click Event of the grid is not being fired.
Any suggestion as to where I am messing things up?
Thanks in advance.
- Ravi
- Ravi
True greatness consists in being great in little things.
- Charles Simmons