Carmen
Registered User.
- Local time
- Today, 19:48
- Joined
- Nov 30, 2001
- Messages
- 58
I am beating my head against the wall and just can't figure out why this isn't working. What I'm trying to do is compare the yr, sem, and modID of a new entry with previous entries. If there's a match, increment by one, if not then it's the first record. I keep getting "Invalid Use of Null", "Type Mismatch", or-the most frustrating-Error message 0 which is no message! The trouble starts right after the Line marked with **. Up til then it works great. Does anybody have any ideas?????
Function calcsecid()
'capture the year of session 1 date as yr and label the fall and _
spring semesters according to the month of session 1. Combine _
yr, sem, and module id to create the section ID field.
Set rst = Me.Recordset
ModID = Forms!frmClasses!ModuleID
session = Forms!frmClasses!Session1
yr = Year(session)
RecCnt = 1
If (DatePart("m", [session]) <= 6) Then
sem = "SP"
ElseIf (DatePart("m", [session]) >= 7) Then
sem = "FA"
End If
*** strSecID = yr & sem & "M" & ModID & "-"
If Not IsNull(SectionID) Then
varLeft = Left(SectionID, InStr(SectionID, "-"))
End If
rst.MoveFirst
Do Until rst.EOF
If strSecID = varLeft Then
RecCnt = RecCnt + 1
Else: RecCnt = RecCnt
End If
rst.MoveNext
Loop
calcsecid = strSecID & RecCnt
Me.SectionID = calcsecid
End Function
[This message has been edited by Carmen (edited 12-18-2001).]
Function calcsecid()
'capture the year of session 1 date as yr and label the fall and _
spring semesters according to the month of session 1. Combine _
yr, sem, and module id to create the section ID field.
Set rst = Me.Recordset
ModID = Forms!frmClasses!ModuleID
session = Forms!frmClasses!Session1
yr = Year(session)
RecCnt = 1
If (DatePart("m", [session]) <= 6) Then
sem = "SP"
ElseIf (DatePart("m", [session]) >= 7) Then
sem = "FA"
End If
*** strSecID = yr & sem & "M" & ModID & "-"
If Not IsNull(SectionID) Then
varLeft = Left(SectionID, InStr(SectionID, "-"))
End If
rst.MoveFirst
Do Until rst.EOF
If strSecID = varLeft Then
RecCnt = RecCnt + 1
Else: RecCnt = RecCnt
End If
rst.MoveNext
Loop
calcsecid = strSecID & RecCnt
Me.SectionID = calcsecid
End Function
[This message has been edited by Carmen (edited 12-18-2001).]