home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 October A / Pcwk10a98.iso / Lotus / LOTUS / SMASTERS / APPROACH / TECHNOTE.MPR / SCRIPT / ApproachDoc / Main / Body / DeleteBtn.s (.txt) < prev    next >
Encoding:
Null Bytes Alternating  |  1997-01-09  |  4.1 KB  |  70 lines

  1. '++LotusScript Development Environment:2:5:(Options):0:66
  2.  
  3. '++LotusScript Development Environment:2:5:(Forward):0:1
  4. Declare Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
  5.  
  6. '++LotusScript Development Environment:2:5:(Declarations):0:2
  7.  
  8. '++LotusScript Development Environment:2:2:BindEvents:1:129
  9. Private Sub BindEvents(Byval Objectname_ As String)
  10.     Static Source As BUTTON
  11.     Set Source = Bind(Objectname_)
  12.     On Event Click From Source Call Click
  13. End Sub
  14.  
  15. '++LotusScript Development Environment:2:2:Click:1:12
  16. Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
  17.     Dim Con As New connection
  18.     Dim Qry As New query
  19.     Dim RS As New resultset
  20.     Dim rval As Integer
  21.     Dim ValidTable, i As Integer
  22.     Dim InputPath As String
  23.     
  24.     ValidTable = False
  25.     
  26.     rval = Messagebox( "Permanently remove Approach sample data?",36,"Lotus Approach")
  27.     If rval = 6 Then
  28.         Forall table In CurrentDocument.tables
  29.             For i = 0 To table.NumFields - 1
  30.                 If table.Fieldnames(i) = "SAMPLE" Then
  31.                     ValidTable = True
  32.                 End If
  33.             Next
  34.             If ValidTable = True Then
  35.                 If (Con.ConnectTo("dBASE IV")) Then
  36.                     Set Qry.Connection = Con
  37.                     Qry.Sql = "SELECT * FROM """ & table.FullName & """ " & table.TableName & " WHERE (" & table.TableName & ".SAMPLE = 'Approach Sample Data')"
  38.                     Set RS.Query = Qry
  39.                     Do While RS.Execute = False
  40.                         InputPath = Inputbox$("Couldn't access "+ table.FullName +" for import." & "Please enter the full path and database name","Warning")
  41.                         If InputPath = "" Then
  42.                             Exit Sub
  43.                         Else
  44.                             Qry.Tablename = InputPath
  45.                         End If
  46.                     Loop
  47.                 Else
  48.                     Messagebox "Couldn't access "+ table.FullName +" for import.  " & "Connection not available"
  49.                     Exit Sub
  50.                 End If
  51.                 
  52.                 Do While RS.numrows <> 0
  53.                     RS.Deleterow
  54.                 Loop
  55.             End If
  56.             ValidTable = False
  57.         End Forall
  58.         
  59.         Set ButtonLbl = CurrentDocument.Main~ Menu.body.DeleteLbl
  60.         Set ButtonDel = CurrentDocument.Main~ Menu.body.DeleteBtn
  61.         Delete ButtonLbl
  62.         Delete ButtonDel
  63.         
  64.         CurrentWindow.SaveChanges
  65.         CurrentWindow.Refresh
  66.         RS.Close
  67.         Con.Disconnect
  68.         
  69.     End If
  70. End Sub