John Clark
John.Clark at niagaracounty.com
Fri Feb 10 06:34:06 CST 2006
I use the code at the bottom to automatically come up with the next number in a series...in this case the next available indictment number. It works great, and I've used it in other programs...I wish I remembered who helped me with this...I've got it in one of my books somewhere, but I recently moved to a new office and I think it is packed somewhere...buuuuuut...they have thrown a wrench into the works. It works for standard, straightforward indictment numbers, but apparently they do a couple of different things, in different situations. One of these is, when multiple people are indicted on a crime (i.e. co-defendants) they would share the "main" indictment number, but a suffix would be added for each subsequent member, after the first entry. For example: Tom, Dick, and Harry get indicted on racketeering charges. Tom is entered first and is assigned the next available number, which is 2006-043. Then Dick is entered, but he doesn't get 2006-044; instead they want to give him 2006-043-1. They then want Harry to get 2006-043-2. There are also instances where there is a lowercase "a" assigned to it...I believe this is something about multiple indictments. I have found current numbers encompassing both these scenarios (2005-043a-1), which really musses things up. And a scenario where it designates handed down from fed court, which isn't a problem...I've just added a field for this and append it...it doesn't really affect the number. Whattaya think? While I was there I discovered that this number system is not anything mandated by the state, and one woman there refuses to follow this procedure, and instead creates a new indictment number for each defendant. This would actually be quite a bit easier on me...I'd be nearly done, with some minor work left. This tells me though, that maybe there needs to be a policy change rather than building the code, if it is possible to being with. Also, if I go through this trouble, and the "rebel" lady still ignores their process of doing things, there really isn't any way to force her through code...there is no way to recognize these people, before they are designated in the program. I'm thinking...depending on what y'all say...of giving them a call and asking about the possibility of changing this procedurally. I probably would have already, but it is one of those clients (department for me) that treats you real good, and you just want to give them whatever they want...you know they'll appreciate it. *** CODE BELOW *** Function NewControlNum() As String Dim strSQL As String Dim strNewID As String Dim rst As Recordset '"Right(Year(Now()),2)" & _ ...this line was in the code strSQL = "SELECT nz(Max(Mid([tblIndictment]![IndictmentNumber],6)),0)+1 AS lngMaxID," & _ "Year(Now())" & _ "& '-' & [lngMaxID] AS lngNewID " & _ "FROM tblIndictment " & _ "WHERE (((Left([tblIndictment]![IndictmentNumber],4))=Right(Year(Now()),4)));" Set rst = CodeDb.OpenRecordset(strSQL) With rst strNewID = rst!lngNewID rst.Close Set rst = Nothing End With NewControlNum = strNewID Rem *************************************************************************** Select Case Len(NewControlNum) Case 6 NewControlNum = Left(NewControlNum, 5) & "00" & Right(NewControlNum, 1) Case 7 NewControlNum = Left(NewControlNum, 5) & "0" & Right(NewControlNum, 2) End Select End Function