Rich
Registered User.
- Local time
- Today, 19:42
- Joined
- Aug 26, 2008
- Messages
- 2,898
This proc used to work fine in A97 but just doesn't work in 2010 any help on converting to the correct proc would be much appreciated
Function CheckNum() As String
Dim db As Database, ssMaxCheck As Recordset, MyDef As QueryDef, MySet As DAO.Recordset
Set db = CurrentDb
Set MyDef = db.QueryDefs("ChNumbQry")
MyDef![Ent] = MyNumb
Set MySet = MyDef.OpenRecordset(MyDef, DB_OPEN_DYNASET)
Set ssMaxCheck = MySet
If Not IsNull(ssMaxCheck.Fields(0).Value) Then
CheckNum = CStr(ssMaxCheck("MaxOfChNo") + 1)
Else:
Dim CurDB As Database, BA As Recordset, SQLStmt As String
Set CurDB = DBEngine.Workspaces(0).Databases(0)
SQLStmt = "SELECT AccTypes.StChNum, AccTypes.AccountTypeID FROM AccTypes;"
Set BA = CurDB.OpenRecordset(SQLStmt, DB_OPEN_DYNASET)
If Not IsNull(BA.Fields(0).Value) And BA![StChNum] > 0 Then
CheckNum = CStr(BA![StChNum])
Else
CheckNum = "00000100"
End If
BA.Close
CurDB.Close
End If
End Function
Function CheckNum() As String
Dim db As Database, ssMaxCheck As Recordset, MyDef As QueryDef, MySet As DAO.Recordset
Set db = CurrentDb
Set MyDef = db.QueryDefs("ChNumbQry")
MyDef![Ent] = MyNumb
Set MySet = MyDef.OpenRecordset(MyDef, DB_OPEN_DYNASET)
Set ssMaxCheck = MySet
If Not IsNull(ssMaxCheck.Fields(0).Value) Then
CheckNum = CStr(ssMaxCheck("MaxOfChNo") + 1)
Else:
Dim CurDB As Database, BA As Recordset, SQLStmt As String
Set CurDB = DBEngine.Workspaces(0).Databases(0)
SQLStmt = "SELECT AccTypes.StChNum, AccTypes.AccountTypeID FROM AccTypes;"
Set BA = CurDB.OpenRecordset(SQLStmt, DB_OPEN_DYNASET)
If Not IsNull(BA.Fields(0).Value) And BA![StChNum] > 0 Then
CheckNum = CStr(BA![StChNum])
Else
CheckNum = "00000100"
End If
BA.Close
CurDB.Close
End If
End Function