'MacroName:508-511to700 'MacroDescription:Copy 508/511 names to 700s 'Macro created by: Joel Hahn, Niles Public Library District 'Last Updated: 24 March 2005 sub main Dim CS as Object Set CS = CreateObject("Connex.Client") 'CS.GetActiveRecord Begin Dialog newdlg 80, 90 OptionGroup .Choice OptionButton 18, 10, 50, 12, "508 to 700" OptionButton 18, 27, 50, 12, "511 to 700" OptionButton 18, 45, 50, 12, "Both to 700" OkButton 7, 62, 30, 14 CancelButton 40, 62, 30, 14 End Dialog Dim Choice as newdlg Choice.Choice = 1 x = Dialog(Choice) If x = 0 Then Goto Done If Choice.Choice <> 1 Then 'User selected either "508 to 700" or "Both to 700" z=1 Do check = CS.GetField("508", z, text$) If check <> FALSE Then count = 1 Do GFcheck = Instr(GFcheck+1,text$,";") If GFcheck > 0 then count = count + 1 Loop While GFcheck > 0 count2 = 1 Do data$ = GetField(text$, count2, ";") If InStr(data$,"by") then pname$ = Trim(GetField(data$, 3, "by")) Else pname$ = Trim(GetField(data$, 2, ",")) End if i = Len(pname$) Do test$ = Mid(pname$,i,1) If test$ = " " Then LastName$ = Right(pname$, Len(pname$)-i) If Right(LastName$,1) = "." Then LastName$ = Left(LastName$, Len(LastName)-1) FirstName$ = Left(pname$, i-1) bool = CS.AddField(999, "7001 " & LastName$ & ", " & FirstName & ".") Exit Do End If i = i - 1 If i = 0 Then bool = CS.AddField(999, "7001 " & pname$ & ".") End If Loop Until i = 0 count2 = count2 + 1 Loop While count2 <= count End if DoNext: z = z + 1 Loop While check <> FALSE End If If Choice.Choice<>0 Then 'User selected either "511 to 700" or "Both to 700" z=1 Do check = CS.GetField("511", z, text$) If check <> FALSE Then count = 1 Do GFcheck = Instr(GFcheck + 1, text$, ",") If GFcheck > 0 then count = count + 1 Loop While GFcheck > 0 count2 = 1 Do pname$ = Trim(GetField(text$, count2, ",")) If count2 = 1 Then pname$ = Right(pname$, Len(pname$)-5) i = Len(pname$) Do test$ = Mid(pname$,i,1) If test$ = " " Then LastName$ = Right(pname$, Len(pname$)-i) If Right(LastName$,1) = "." Then LastName$ = Left(LastName$, Len(LastName)-1) FirstName$ = Left(pname$, i-1) bool = CS.AddField(999, "7001 " & LastName$ & ", " & FirstName & ".") Exit Do End If i = i - 1 If i = 0 Then bool = CS.AddField(999, "7001 " & pname$ & ".") End If Loop Until i = 0 count2 = count2 + 1 Loop While count2 <= count End If DoNext2: z = z + 1 Loop While check=TRUE End If Done: end sub