By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Delete data from three tables

100+
P: 229
Hi, I have this that works fine.


Expand|Select|Wrap|Line Numbers
  1.     dim strSQLDeleteWatch
  2.     strSQLDeleteWatch = "Delete from tblWatches where WatchedProfileID = " & rsProfiles("ProfileID")
  3.     objConn.Execute strSQLDeleteWatch
  4.  
  5.             rsProfiles.movenext
  6.         wend
  7.  
  8.     strSQLDeleteWatch = "Delete from tblWatches where WatchingUserID = " & intOptionsAndInfoUserIdDelete
  9.     objConn.Execute strSQLDeleteWatch
  10.  
  11.         rsProfiles.close
  12.         set rsProfiles = Nothing



I need to delete other associated data like.


Expand|Select|Wrap|Line Numbers
  1. 'dim strSQLDeletelink
  2.     'strSQLDeletelink = "Delete from tblLinkTrackerLogs where link_id = " & rsProfiles("ProfileID")
  3.     'objConn.Execute strSQLDeletelink
I cannot see where I need to include it with the wend that is currently there. Any pointers would be great.
Thanks in advance.
Richard
May 22 '13 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,327
We don't know either, you haven't told us how it's related so it's difficult to say how to delete the relation.
May 22 '13 #2

100+
P: 229
Hi, thanks for the reply.

Looks like i solved it by adding the other delete above the two connected by wend


Expand|Select|Wrap|Line Numbers
  1.     dim strSQLDeletelink
  2.     strSQLDeletelink = "Delete from tblLinkTrackerLogs where link_id = " & rsProfiles("ProfileID") 
  3.     objConn.Execute strSQLDeletelink    
  4.  
  5.  
  6.    dim strSQLDeleteWatch
  7.     strSQLDeleteWatch = "Delete from tblWatches where WatchedProfileID = " & rsProfiles("ProfileID")
  8.     objConn.Execute strSQLDeleteWatch
  9.  
  10.             rsProfiles.movenext
  11.         wend
  12.  
  13.  
Thanks
Richard
May 25 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.