'MacroName:DeleteSelected650And655
'MacroDescription:Delete 6XX from non-approved thesauri from a bibliographic record
'Author: Shelby Anderson
'Date written: 9/22/2022
'Updated: 11/18/2022
'Purpose:Delete 6XX from non-approved thesauri from a bibliographic record
'No guarantees are promised or implied.
Sub Main
Dim CS As Object
On Error Resume Next
Set CS = GetObject(,"Connex.Client")
On Error GoTo 0
If CS Is Nothing Then
Set CS = CreateObject("Connex.Client")
End If
Dim c As Integer
Dim sField As String
'Process600
'This routine will delete any field 600 from non-approved thesauri
c = 1 'Counter to loop through multiple 600s in a record
Do While CS.GetField ("600", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 aat") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
'Process610
c = 1 'Counter to loop through multiple 610s in a record
Do While CS.GetField ("610", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 aat") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
'Process611
c = 1 'Counter to loop through multiple 611s in a record
Do While CS.GetField ("611", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 aat") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
'Process630
c = 1 'Counter to loop through multiple 630s in a record
Do While CS.GetField ("630", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 aat") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
'Process650
c = 1 'Counter to loop through multiple 650s in a record
Do While CS.GetField ("650", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 aat") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
'Process651
c = 1 'Counter to loop through multiple 651s in a record
Do While CS.GetField ("651", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 aat") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
'Process655
c = 1 'Counter to loop through multiple 655s in a record
Do While CS.GetField ("655", c, sField)
If Mid(sField, 5, 1) = "1" OR Mid(sField, 5, 1) = "4" OR Mid(sField, 5, 1) = "6" Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
ElseIf InStr(sField,"CaQQLa") > 0 OR InStr(sField,"2 gtt") > 0 OR InStr(sField,"2 ram") > 0 OR InStr(sField,"2 gnd") > 0 OR InStr(sField,"2 rvmgf") > 0 OR InStr(sField,"2 swd") > 0 Then
bool=CS.DeleteField (left(sField,3), c) 'Delete the field, rinse and repeat
Else 'Doesn't match above so
c = c + 1 'Add 1 to the counter and look at the next one
End If
Loop
Done:
End Sub