Delete data from three tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fran7
    New Member
    • Jul 2006
    • 229

    Delete data from three tables

    Hi, I have this that works fine.


    Code:
    	dim strSQLDeleteWatch
    	strSQLDeleteWatch = "Delete from tblWatches where WatchedProfileID = " & rsProfiles("ProfileID")
    	objConn.Execute strSQLDeleteWatch
    
                rsProfiles.movenext
            wend
    
    	strSQLDeleteWatch = "Delete from tblWatches where WatchingUserID = " & intOptionsAndInfoUserIdDelete
    	objConn.Execute strSQLDeleteWatch
    
            rsProfiles.close
            set rsProfiles = Nothing



    I need to delete other associated data like.


    Code:
    'dim strSQLDeletelink
    	'strSQLDeletelink = "Delete from tblLinkTrackerLogs where link_id = " & rsProfiles("ProfileID")
    	'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
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    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.

    Comment

    • fran7
      New Member
      • Jul 2006
      • 229

      #3
      Hi, thanks for the reply.

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


      Code:
      	dim strSQLDeletelink
      	strSQLDeletelink = "Delete from tblLinkTrackerLogs where link_id = " & rsProfiles("ProfileID") 
      	objConn.Execute strSQLDeletelink	
      
      
         dim strSQLDeleteWatch
          strSQLDeleteWatch = "Delete from tblWatches where WatchedProfileID = " & rsProfiles("ProfileID")
          objConn.Execute strSQLDeleteWatch
       
                  rsProfiles.movenext
              wend
      Thanks
      Richard

      Comment

      Working...