Customised Record Count Fields

Rusty

Registered User.
Local time
Today, 11:56
Joined
Apr 15, 2004
Messages
207
Hey Guys,

I’ve attached a zipped example of the problem I am having with customised navigation buttons.

In my main database the form “subfrmPersonsContact” works perfectly. I have exported it to a new database and now the customised record count fields do not work at all – they are in fact blank even though the navigation buttons do still work.

The code running the form and the record count fields is listed below – I have no idea why it’s not working.

Any help would be greatly appreciated.

Cheers,

Rusty
:D


Code:
Private Sub Form_Current()
On Error GoTo err_Form_Current

Dim rs As Recordset
Dim Count As Integer, Position As Integer

    Set rs = Me.RecordsetClone
    rs.MoveLast
    rs.MoveFirst

    Count = rs.RecordCount
    Me!txtRecCnt = "of  " & Count

    Position = Me.CurrentRecord
    Me!txtRecPos = Position

    
    If Position = 1 Then
        Me!gotoPrevious.Enabled = False
        Me!gotoFirst.Enabled = False
    Else
        Me!gotoPrevious.Enabled = True
        Me!gotoFirst.Enabled = True
    End If

    If Position = Count Then
        Me!gotoNext.Enabled = False
        Me!gotoLast.Enabled = False
        Me!txtRecCnt = "of  " & Position
    Else
        Me!gotoNext.Enabled = True
        Me!gotoLast.Enabled = True
        Me!txtRecCnt = "of  " & Count
    End If
   
    rs.Close

exit_Form_Current:
    Exit Sub

err_Form_Current:
    If Err.Number = 3021 Then
        Resume Next
    Else
        Resume exit_Form_Current
    End If
End Sub
 

Attachments

Add this to your code and you'll see what is going on:
Code:
err_Form_Current:
    If Err.Number = 3021 Then
        Resume Next
    Else
       [B]MsgBox "Error No:    " & Err.Number & vbCr & _
              "Description: " & Err.Description[/B]
       Resume exit_Form_Current
    End If
 

Users who are viewing this thread

Back
Top Bottom