DJimmie / JS_Program

Scheduling program in Excel VBA. To be replaced by the Python version in the near future.
0 stars 0 forks source link

allow the user to delete all Voided TPs from the Database #10

Closed DJimmie closed 5 years ago

DJimmie commented 5 years ago

allow the user to delete all Voided TPs from the Database.

DJimmie commented 5 years ago

Placed a button on the TDC Testing tab for the user to click and remove voided test plans when ready.

DJimmie commented 5 years ago

Used the following code: `Sub remove_void_TP()

Dim conn As Object, rst As Object Dim strSQL As String

Set conn = CreateObject("ADODB.Connection") Set rst = CreateObject("ADODB.Recordset")

'On Error GoTo No_Server_Available

' OPEN CONNECTION conn.Open "DRIVER=SQLite3 ODBC Driver;Database=\camradfs01.ccc.coopcam.com\testlab_i\CTC Test Plan Operations\TSMS_database.db"

strSQL = "DELETE FROM tsd_table_1 WHERE Test_Phase='Void'" ' OPEN RECORDSET rst.Open strSQL, conn, 1, 1

' FREE RESOURCES Set rst = Nothing Set conn = Nothing

Exit Sub

No_Server_Available: MsgBox "The Server is currently unavailable or you do not have the SQLite ODBC driver. Try again later or verify you have the ODBC driver installed on your PC." 'Exit Sub Application.Visible = True 'ThisWorkbook.Close savechanges:=False

End Sub`