Stuck in a record on a continuous form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    Stuck in a record on a continuous form

    I'm suddenly having a major problem trying to switch between rows in a continuous form in Access 2007. The form represents a timesheet and has a row for each activity that an employee may work on. There are 14 columns on the form for the days in the pay period, and each day is a text box, basically simulating a spreadsheet. So a row is a record in my source table. If my cursor is in day1, and I click another row, it moves the cursor to the new cell properly. If my cursor is in any other cell in the row, I can move within that row, but if I click another row, nothing happens. So everything is fine in day1, but not the rest, even though all the properties are the same.

    I assumed this was connected, but it may not be, judging by the mouse not changing cells correctly. My users want to be able to use the up and down arrow keys to move between activities, so I'm using some borrowed code in each of the 14 text boxes:

    Dim LastRec As Long
    LastRec = Me.Recordset.Re cordCount
    If Shift = 0 Then
    If KeyCode = vbKeyUp Then
    If Me.CurrentRecor d > 1 Then Me.Recordset.Mo vePrevious
    KeyCode = 0
    ElseIf KeyCode = vbKeyDown Then
    If Me.CurrentRecor d < LastRec Then Me.Recordset.Mo veNext
    KeyCode = 0
    End If
    End If

    This was working fine up until today, and I don't know what's changed. I compared everything to a backup version and found nothing different. If I step through the code, the RecordSet.Absol utePosition is changing, but the CurrentRecord is remaining the same, and the cursor onscreen is remaining in the same box. So after pressing the up arrow several times depending on where I started in the sheet, I get an error 3021 - No current record. The underlying RecordSet is changing position, but it's not showing on the form.

    This is my first Access project, so I may be missing something simple. I would appreciate it immensely if anyone could shed some light on this for me.

    Thanks,
    Chip


    More info that may not matter:
    Table - EmployeeHours
    Fields - EmployeeNumber* , PayPeriod*, ProjectNumber*, ActivityNumber* , ActivityTitle*, HoursType*, Day1, Day2, Day3, Day4, Day5, Day6, Day7, Day8, Day9, Day10, Day11, Day12, Day13, Day14, Rate, TotalHours, DollarAmount, Status
    * - primary key
    This continuous form is a subform on another form, and has enabled=false until a button is clicked. The source for the subform is set when the parent form opens or when the user selects the payperiod from a dropdown.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    I was looking at a backup, considering redoing all of todays work on it, and now I'm getting the same thing happening. But now if I'm in a day1 cell, and click another row, the text in day1 is selected, and if I click again, the cursor moves to that cell. Still can't figure out what is going on though.

    Comment

    • ChipR
      Recognized Expert Top Contributor
      • Jul 2008
      • 1289

      #3
      Well I forgot that I had some code to round the values for each of the text boxes.

      Private Sub Day1__Exit(Canc el As Integer)
      Day1 = Round(Day1 + 0.00001, 2)
      End Sub

      It seems that was somehow stopping me from exiting the cell, as it worked fine when I commented all those out.
      Anyone know what even should I use to round in so that I won't get stuck in the cell?

      Thanks,
      Chip

      Comment

      Working...