Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a nod 2

Status
Not open for further replies.

hoofit

Technical User
Nov 20, 2005
343
US
I have a treeview control 3 levels deep and I need to delete a nod and am not sure how this is done. Essentially, I'm thinking of setting up an index using a double click event;

idx = TreeView0.SelectedItem.Index

So, to identify the the 3 levels and thus remove them, I see idx+2. I tried delete nod, nod.parent, nod.parent.parent but do not know the correct syntax. Same with DoCmd.runSQL "Delete nod.......Can someone point me north?

hoof
 
Provided that nod is the right object:
Code:
DoCmd.RunSQL "DELETE * FROM PMInterval WHERE PMName='" & (Right$(nod.Key, 5)) [!]& "'"[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here is a coding hint

dim strSql as string
'make your string
strSql = "DELETE * FROM PMInterval WHERE PMName='" & (Right$(nod.Key, 5)) & "'"
'verify you string
debug.print strSql
docmd.runSql strSql

If you had done this, then you could see why you have a problem. Whenever I write a sql string I do this.
 
Good evening coders,

Here's what I ended up doing;


DoCmd.RunSQL "DELETE * FROM PMInterval WHERE PMName='" & (Right$(nod.Key, 5)) & "'"

DoCmd.RunSQL "DELETE * FROM PM WHERE PMName='" & (Right$(nod.Key, 5)) & "'"

Now comes the hard part, who gets credit.PHV came up with the solution which I used. MajP had tons of info and took the time to look at my issue. Honestly, I do not know how you can look at a posted issue, given little info and manage to come up with answers. Such a talent. Since this is a site which, at the end of the day, has had it's purpose fulfilled by questions like mine and solved by you, I must give stars to both. Onward I say....

hoof
 
Good evening coders,

Here's what I ended up doing;


DoCmd.RunSQL "DELETE * FROM PMInterval WHERE PMName='" & (Right$(nod.Key, 5)) & "'"

DoCmd.RunSQL "DELETE * FROM PM WHERE PMName='" & (Right$(nod.Key, 5)) & "'"

Now comes the hard part, who gets credit.PHV came up with the solution which I used. MajP had tons of info and took the time to look at my issue. Honestly, I do not know how you can look at a posted issue, given little info and manage to come up with answers. Such a talent. Since this is a site which, at the end of the day, has had it's purpose fulfilled by questions like mine and solved by you, I must give stars to both. Onward I say....I have a followup post to this issue;

(Right$(nod.Key, 5)) & "'"

hoof
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top