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

You want to delete the record from the grid's recordsource and the record you want to delete is the row which the user is on? What is the purpose of the second grid?

How about issuing code like this in the click of the delete button?
DELETE IN (THISFORM._grid1.RecordSource)

Will

>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
Heavy Metal Pedal - click with care
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform