E
Elizabeth Swoope
I have a tabular form that has an "Enter" event and and "Exit" event on the
first field in the table and on the form. There are no other events
associated with the form or any fields on the form.
If I open the form, the cursor is on the first record in the table, as it
should be. To the left of the row is the > arrow. When I use the "Add record"
button (the one with the other nav buttons at the bottom of the form),
instead of getting a new blank record, the first record is edited. That is,
the arrow on the left changes to the pencil.
I created another similar form with no events at all and it works as I'd
expect, with the "new record" button taking me to a new record, not opening
the current record for editing.
Here's the code for the events, in case that's helpful. (Thanks to Bruce for
the meat of the code, which is working properly to subdivide an entry into
pieces.)
I'm thinking that there's something in the Exit code that is triggering
"edit", which I don't want.
Any input is appreciated.
Thanks,
liz
Private Sub CourseCode_Enter()
Dim strCourseCode As String
If Not IsNull(Me.CourseCode) Then strCourseCode = Me.CourseCode
End Sub
Private Sub CourseCode_Exit(Cancel As Integer)
Dim strCodeLength As String
Dim strRubric As String
Dim strCourseNo As String
Dim intLetterPart As Integer
If Me.CourseCode <> strCourseCode Then
strCodeLength = Len(Me.CourseCode)
If (Val(Right(Me.CourseCode, 4))) = 0 Then
intLetterPart = Len(Me.CourseCode) - 3
strCourseNo = Right(Me.CourseCode, 3)
strRubric = Left(Me.CourseCode, intLetterPart)
Else
intLetterPart = Len(Me.CourseCode) - 4
strCourseNo = Right(Me.CourseCode, 4)
strRubric = Left(Me.CourseCode, intLetterPart)
End If
Me.Rubric = strRubric
Me.CourseNo = strCourseNo
End If
End Sub
first field in the table and on the form. There are no other events
associated with the form or any fields on the form.
If I open the form, the cursor is on the first record in the table, as it
should be. To the left of the row is the > arrow. When I use the "Add record"
button (the one with the other nav buttons at the bottom of the form),
instead of getting a new blank record, the first record is edited. That is,
the arrow on the left changes to the pencil.
I created another similar form with no events at all and it works as I'd
expect, with the "new record" button taking me to a new record, not opening
the current record for editing.
Here's the code for the events, in case that's helpful. (Thanks to Bruce for
the meat of the code, which is working properly to subdivide an entry into
pieces.)
I'm thinking that there's something in the Exit code that is triggering
"edit", which I don't want.
Any input is appreciated.
Thanks,
liz
Private Sub CourseCode_Enter()
Dim strCourseCode As String
If Not IsNull(Me.CourseCode) Then strCourseCode = Me.CourseCode
End Sub
Private Sub CourseCode_Exit(Cancel As Integer)
Dim strCodeLength As String
Dim strRubric As String
Dim strCourseNo As String
Dim intLetterPart As Integer
If Me.CourseCode <> strCourseCode Then
strCodeLength = Len(Me.CourseCode)
If (Val(Right(Me.CourseCode, 4))) = 0 Then
intLetterPart = Len(Me.CourseCode) - 3
strCourseNo = Right(Me.CourseCode, 3)
strRubric = Left(Me.CourseCode, intLetterPart)
Else
intLetterPart = Len(Me.CourseCode) - 4
strCourseNo = Right(Me.CourseCode, 4)
strRubric = Left(Me.CourseCode, intLetterPart)
End If
Me.Rubric = strRubric
Me.CourseNo = strCourseNo
End If
End Sub