Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting records using SQL Delete in Grids
Message
From
02/08/2001 14:14:30
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Deleting records using SQL Delete in Grids
Miscellaneous
Thread ID:
00538999
Message ID:
00538999
Views:
42
Hello Gurus:

I have 2 grids on a form. The first grid displays the fields from a table (only2 fields exist in the table). The second grid will be visible when a sarch has been made for a particular record.

The problem: If the user clicks on the first column, say row two on the grid, then, the value of column1.text1 is stored in a variable and the value of column2.text1 in another variable. Now the user can click delete to delete the record from the table. This should happen to only that particular record. If the user clicks the column2, say row 3, then column2.text1 will be stored in a variable and column1.text1 of the same row in another varaibale for deletion later. This is the code I have in the Click Event of the two grids (this one, as an example for grid1):

If !thisform._grid2.visible
mprimedelete = thisform._grid1.column1.text1.value
mseconddelete = thisform._grid1.column2.text1.value
else
mprimedelete = thisform._grid2.column1.text1.value
mseconddelete = thisform._grid2.column2.text1.value
endif

The Click Event of the Delete button has the following code:

DELETE FROM rev_locations;
WHERE alltrim(rev_locations.primaryloc) == alltrim(mprimedelete) .and.;
alltrim(rev_locations.secondloc) == alltrim(mseconddelete)

Note that only the select row should be deleted, since either column1 or colum2 can have repeated values. So I am looking at deleting a very specific row that the user has chose. With the aboe, codes, the memory variable do not appear to be capturing the right values from teh columns for deletion later.

Thanks in advance for your suggestions.

- Ravi
- Ravi

True greatness consists in being great in little things.
- Charles Simmons
Next
Reply
Map
View

Click here to load this message in the networking platform