Trying to delete patron record and receive "Unable to delete patron" error
- Product: Voyager
- Relevant for Installation Type: Multi-Tenant Direct, Dedicated-Direct, Local, TotalCare
Question
Unable to delete patron record. Checked to make sure have correct permissions.
Receive "Unable to delete patron. Patron has existing stub patrons" or "Unable to delete patron" error.
Answer
There are various reasons why patron records can't be deleted. These reasons include that the patron has fines/fees, existing charges, or pending requests. These must be cleared before the record can be deleted. See: Overview of the Voyager patron record purge for a complete list of these reasons.
Additional Information
The following Prepackaged Reports Access query may help you to determine why a patron record can't be deleted. It will prompt you for a barcode and display which reasons the patron can't be deleted apply to the patron record.
Note that patron records can have duplicate barcodes. For that reason, the Patron ID number from the title bar in the circulation client is included in the query results (in parentheses).
SELECT 'Last_name:' & patron.last_name & ' (' & patron_barcode.patron_id & ')' AS reason
FROM patron_barcode INNER JOIN patron ON patron_barcode.PATRON_ID = patron.PATRON_ID
WHERE (((patron_barcode.[patron_barcode])=[Patron barcode:]) AND ((patron_barcode.patron_id)=[patron].[patron_id]))
UNION ALL select distinct 'At your library, one or more items charged out.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, circ_transactions
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = circ_transactions.patron_id
UNION ALL
select distinct 'At your library, one or more pending holds.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, hold_recall
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = hold_recall.patron_id
and request_item_count <> '-1'
UNION ALL
select distinct 'At your library, unpaid fines or fees.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, fine_fee
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = fine_fee.patron_id and fine_fee_balance <>'0'
UNION ALL
select distinct 'At your library, one or more circ transaction exceptions.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, circ_trans_exception
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = circ_trans_exception.patron_id
UNION ALL
select distinct 'At your library, one or more pending requests.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, call_slip
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = call_slip.patron_id;
UNION ALL
select distinct 'At your library, items en route from another lib.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, ub_routing
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = ub_routing.patron_id_ub
and db_id_from <> '0'
and db_id_to = '0'
UNION ALL
SELECT DISTINCT 'At your library, patron has proxies. '
& '(' & patron_barcode.patron_id & ')' AS Reason
FROM PATRON_BARCODE INNER JOIN PROXY_PATRON ON
PATRON_BARCODE.PATRON_BARCODE_ID = PROXY_PATRON.PATRON_BARCODE_ID
WHERE (((PATRON_BARCODE.PATRON_BARCODE)=[Patron barcode:]))
UNION ALL
SELECT 'At your library, patron is a proxy for '
& patron_barcode.patron_barcode
& '. (' & patron_barcode_1.patron_id & ')' AS Reason
FROM (PROXY_PATRON INNER JOIN PATRON_BARCODE ON
PROXY_PATRON.PATRON_BARCODE_ID = PATRON_BARCODE.PATRON_BARCODE_ID) INNER
JOIN PATRON_BARCODE AS PATRON_BARCODE_1 ON
PROXY_PATRON.PATRON_BARCODE_ID_PROXY =
PATRON_BARCODE_1.PATRON_BARCODE_ID
WHERE (((PATRON_BARCODE_1.PATRON_BARCODE)=[Patron barcode:]))
UNION ALL
SELECT DISTINCT 'At another library ('
& mid([voyager_databases].[db_code],2,3) & '), there is a stub patron record.'
& ' (' & patron_barcode.patron_id & ')' AS reason
FROM patron_barcode, ub_patron_record, voyager_databases
WHERE (([patron_barcode].[PATRON_BARCODE]=[Patron barcode:])
AND ([patron_barcode].[PATRON_ID]=[ub_patron_record].[patron_id])
AND ([ub_patron_record].[db_id] = [voyager_databases].[db_id]))
UNION ALL
select distinct 'At another library, fines owed.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, ub_fine_fee
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = ub_fine_fee.patron_id
and fine_fee_total <> '0'
UNION ALL
select distinct 'At another library, requests pending.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, ub_request
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = ub_request.patron_id
UNION ALL
select distinct 'At another library, items charged.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, ub_charge
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = ub_charge.patron_id
UNION ALL
select distinct 'At another library, items on hold.'
& ' (' & patron_barcode.patron_id & ')' as reason
from patron_barcode, ub_hold
where patron_barcode=[Patron barcode:]
and patron_barcode.patron_id = ub_hold.patron_id;
Constructing custom SQL queries by request and troubleshooting unexpected results from customer-created SQL queries falls outside the scope of Support. The above has been posted for informational purposes. Voyager-L and Developer Network are useful resources for finding helpful custom SQL or obtaining assistance from peers in troubleshooting custom queries.
- Article last edited: 04-Dec-2020

