I am getting an error of Run-time error '94': invalid use of Null. I have the code below. This is when I am creating a new record and there isn't data to add to... I have a default value of 0 in the docSeries column. Any ideas???
Code:Option Explicit Public Function getDocID(TypeID As Integer, series As Single, version As Single) As Long Dim strWhere As String strWhere = "DocType = " & TypeID & " AND DocSeries = " & series & " AND DocVersion = " & version getDocID = Nz(DLookup("DocID", "tblDocInfo", strWhere)) End Function Public Function getSeries(docID As Long) As Single On Error GoTo errlabel Const fldName = "DocSeries" Const tblName = "tblDocInfo" getSeries = DLookup(fldName, tblName, "DocID = " & docID) Exit Function errlabel: MsgBox Err.Number & " " & Err.Description End Function Public Function getNextSeries(docID As Long) As Single getNextSeries = getSeries(docID) + 0.001 End Function Public Function getMaxSeriesForType(TypeID As Integer) As Single Const fldName = "DocSeries" Const tblName = "tblDocInfo" Const typeName = "DocType" Dim strWhere As String strWhere = typeName & " = " & TypeID getMaxSeriesForType = DMax(fldName, tblName, strWhere) End Function Public Function getNextSeriesForType(TypeID As Integer) As Single getNextSeriesForType = getMaxSeriesForType(TypeID) + 0.001 End Function




Reply With Quote
