'**************R E A D M E ! ! !***************** 'Due credits to Gary Strawn for his VoyagerReader.dll and help 'Before you start this program 'First review your scanned list ' 'Make sure that the shelf and range barcode is before the item barcode(s) 'Otherwise, the program will assign NO shelf information to those item record(s) 'Until it finds a valid shelf barcode in your list 'It should look like this 'RAN36SEC05SF02 '31334020238909 '31334020123456 ' '*************************************************** Private Sub Command1_Click() Dim MyBatchCat As New ClassBatchCat Dim myVgerReader As New VgerRead5 ' you may create ini file for the logon info. ' list everything here so you see them at one place ' the name of the ODBC connection myVgerReader.DSN = "yourDSNname" ' the read-only user ID myVgerReader.uID = "yourVoyagerReadOnlyID" ' the read-only password myVgerReader.PWD = "yourVoyagerReadOnlyPassword" 'Disable the one control Command1.Enabled = False 'Declare some variables Dim sDateTime$, sStart$ Dim lsFile As String Dim strBarcode As String, strSCAN As String Dim strShelfRange As String, iResultSet As String Dim intLogin As Integer, intResult As Integer Dim intIn As Integer, intOut As Integer Dim lngCatLoc As Long, lngLibID As Long sStart$ = Format(Now, "yyyy-mm-dd hh:mm:ss") ' preserve also the start date/time in this format, for use in file names sDateTime$ = Mid(sStart$, 1, 4) + Mid(sStart$, 6, 2) + Mid(sStart$, 9, 2) + "." + Mid(sStart$, 12, 2) + Mid(sStart$, 15, 2) + Mid(sStart$, 18, 2) 'Browse the input file CommonDialog1.Filter = "All Files|*.*" CommonDialog1.ShowOpen If CommonDialog1.FileName <> "" Then lsFile = CommonDialog1.FileName End If 'Open input and output (log) files intIn = FreeFile Open lsFile For Input As #intIn intOut = FreeFile Open "C:\Add Free Text Report " + sDateTime$ + ".txt" For Output As #intOut ' you may create ini file for these 'Assign a couple of values lngCatLoc = yourCatalogingLocationID lngLibID = yourLibraryID ' you may create ini file for these 'Login intLogin = MyBatchCat.Connect("C:\Program Files\Voyager", "yourVoyagerID", "yourVoyagerPassword") 'Check - is it a valid login? If intLogin <> 0 Then MsgBox ("Unsuccessful login! Error Code " & CStr(intLogin)) End 'We exit the program immediately!! End If 'Clear counter Itemchanged1% = 0 Itemchanged2% = 0 ItemNOTchanged% = 0 'Start the loop Do While Not EOF(intIn) 'Read lines of the scanned file Line Input #intIn, strSCAN 'Check - is it a UTA barcode? 'If it starts with "31334" as all UTA barcodes do 'but does not match any item record, it will be written to the log file 'at the point of getting item record number If Mid(strSCAN, 1, 5) = "31334" Then 'Item barcodes to use strBarcode = strSCAN 'Hand it over to VgerReader myVgerReader.ItemBarcode = strBarcode 'Search barcode in Vger DB myVgerReader.SearchItemBarcode 'Create a result set of item IDs iResultSet = myVgerReader.ResultSet 'Read from the set myVgerReader.GetNextRow If Len(myVgerReader.CurrentRow(1)) > 0 Then myVgerReader.ItemRecordNumber = myVgerReader.CurrentRow(1) 'Retrieve item record myVgerReader.RetrieveItemRecord 'Pass the item data to the BatchCat DLL myVgerReader.CopyItemObject MyBatchCat.cItem 'Set new value for FreeText If Len(MyBatchCat.cItem.FreeText) = 0 And Len(strShelfRange) > 0 Then MyBatchCat.cItem.FreeText = strShelfRange 'Write changed record back to Voyager lReturn = MyBatchCat.UpdateItemData(lngCatLoc) 'Counter If lReturn = Ture Then Itemchanged1% = Itemchanged1% + 1 End If End If If Len(MyBatchCat.cItem.FreeText) > 0 And Len(strShelfRange) > 0 Then MyBatchCat.cItem.FreeText = MyBatchCat.cItem.FreeText + ", " + strShelfRange 'Write changed record back to Voyager lReturn = MyBatchCat.UpdateItemData(lngCatLoc) 'Counter If lReturn = Ture Then Itemchanged2% = Itemchanged2% + 1 End If End If If Len(strShelfRange) = 0 Then Print #intOut, "" Print #intOut, myVgerReader.ItemBarcode + " has not been updated with a valid shelf barcode" Print #intOut, "" End If Else Print #intOut, myVgerReader.ItemBarcode + " does not have an item record. Find the item under " + strShelfRange ItemNOTchanged% = ItemNOTchanged% + 1 End If Else 'Make sure it is valid shelf barcode If Mid(strSCAN, 1, 3) = "RAN" And Mid(strSCAN, 6, 3) = "SEC" And Mid(strSCAN, 11, 2) = "SF" Then strShelfRange = strSCAN 'If it is not a item barcode or a shelf barcode, it goes to the log file right away Else Print #intOut, "" Print #intOut, strSCAN & " is not a valid barcode" Print #intOut, "" GoTo Skip End If End If 'The GoTo label: Skip: Loop MsgBox Itemchanged1% + Itemchanged2% & " Item Records Have Been Updated" If ItemNOTchanged% > 0 Then MsgBox "At least another " & ItemNOTchanged% & " with problem. See the log file." Print #intOut, "" Print #intOut, "**************************************" Print #intOut, "" Print #intOut, ItemNOTchanged% & " with item barcode problems." End If Print #intOut, Itemchanged1% + Itemchanged2% & " Item Records Have Been Updated" 'Close files, dismiss form Close #intOut Close #intIn Unload Form1 End Sub