How can I make a bin inactive? - Need to find which part is using this bin as Primary Bin

I’m not trying to delete the bin numbers - I just want to inactivate them. When I try, I get the error saying, “Cannot set as Inactive. Bin is set as Primary Bin for a part.”

I have tried running BAQ’s on the following tables: WhseBin, PartWhse, PartBin, PartTran, and PartBinInfo.

The PartWhse.PrimBinNum field I’d like to use is an external field. I don’t see any part with a Primary bin as anything other than 1 so I don’t think I’m querying the right fields. I’ve tried so many combinations now I’ve lost count.
I know you can’t inactivate a bin if it has any on-hand quantity, but the IsEmpty field on Warehouse Bin Maintenance shows both these bins as empty, so I think I’m good here. The error is pretty specific, so it’s got to be the primary bin set for a part, but which fields should I be using to query that?

I found records where the Bins in question are appearing as BinNum2 on the PartTran table. (BinNum2 displays the WH Bin either from or to, I think, I can’t remember at the moment.) Not sure if that’s helpful. I’ll attach a screenshot of that BAQ - they are all fields from only the PartTran table where the BinNum or BinNum2 were not blank or “1”.
PartTran Table records to review.xlsx (98.5 KB)

Thank you!

It’s in the PlantWhse table. Field called PrimBin.

Thanks, Mark! Exactly what I needed.

Have a happy Thanksgiving!

In case anyone is interested this query shows a listing of parts with their primary bins for a certain company/plant:

DECLARE @Company AS NVARCHAR(8) = 'SD'
	  , @Plant AS NVARCHAR(8) = 'MfgSys';

SELECT 
	 pwh.Company
	, pwh.Plant
    , pwh.WarehouseCode
	, pwh.PartNum
	, pwh.PrimBin	

FROM 
	erp.PlantWhse AS pwh WITH (NOLOCK)

WHERE 
	pwh.Company = @Company 
	AND pwh.Plant = @Plant
2 Likes