visible buttons problem

timeh

Registered User.
Local time
Today, 08:22
Joined
Apr 11, 2002
Messages
23
hi, i'm writing a database, and on one of my forms, i've created two buttons to go to "previous" and "next" records. What I would like to be able to do is make it so that if there is only 1 record, the "previous" and "next" buttons go invisible, does anyone know how to do this?

Also, could someone please tell me how the "on current" option in the events tab for a form works?
thanks in advance,

Tim
 
PHP:
Private Sub Form_Current()

    Dim recClone As Recordset
    Dim intNewRecord As Integer
    
    Set recClone = Me.RecordsetClone
    
    intNewRecord = IsNull(Me.Date)
    
    If intNewRecord Then
        cmdPrev.Visible = True
        cmdNext.Visible = False
        Exit Sub
    End If
        
    If recClone.RecordCount = 0 Then
        cmdPrev.Visible = False
        cmdNext.Visible = False
    Else
    
    recClone.Bookmark = Me.Bookmark
    
    recClone.MovePrevious
    cmdPrev.Visible= Not (recClone.BOF)
    recClone.MoveNext
    
    recClone.MoveNext
    cmdNext.Visible = Not (recClone.EOF)
    recClone.MovePrevious
    
    End If
    
    recClone.Close

End Sub
 
Also, the On Current event happens when focus moves from one record to another and also when a form opens.
 
I use .enable = true / false
That way the user stills sees the button but realises that they have gone as far as they can, not 'hey where did that button go?'
 
Oldsoftboss said:
I use .enable = true / false
That way the user stills sees the button but realises that they have gone as far as they can, not 'hey where did that button go?'

I prefer that too, just changed my code to affect the buttons visibilty too.
 

Users who are viewing this thread

Back
Top Bottom