M
magmike
I have a subform that shows multiple records (notes) per client. In
the subform header are navigation buttons including a button to create
a new record. I have successfully programmed the buttons to disable
when there is no more records in their direction this way (please tell
me if there is a better way):
If Me.RecordsetClone.RecordCount - Me.CurrentRecord = 0 Then
Me.GoNext.Enabled = False
Me.GoLast.Enabled = False
Else:
Me.GoNext.Enabled = True
Me.GoLast.Enabled = True
End If
If Me.CurrentRecord = 1 Then
Me.GoPrevious.Enabled = False
Me.GoFirst.Enabled = False
Else:
Me.GoPrevious.Enabled = True
Me.GoFirst.Enabled = True
End If
However, I am trying to disable all these buttons (except the New
Record button) when there are no records on the form. I haven't
figured that one out yet. This is what I tried (unsuccessfully):
If IsNull(Me.Recordset) Then
Me.GoPrevious.Enabled = False
Me.GoFirst.Enabled = False
Me.GoNext.Enabled = False
Me.GoLast.Enabled = False
Else:
Me.GoPrevious.Enabled = True
Me.GoFirst.Enabled = True
Me.GoNext.Enabled = True
Me.GoLast.Enabled = True
End If
Thanks in advance for your help!
magmike
the subform header are navigation buttons including a button to create
a new record. I have successfully programmed the buttons to disable
when there is no more records in their direction this way (please tell
me if there is a better way):
If Me.RecordsetClone.RecordCount - Me.CurrentRecord = 0 Then
Me.GoNext.Enabled = False
Me.GoLast.Enabled = False
Else:
Me.GoNext.Enabled = True
Me.GoLast.Enabled = True
End If
If Me.CurrentRecord = 1 Then
Me.GoPrevious.Enabled = False
Me.GoFirst.Enabled = False
Else:
Me.GoPrevious.Enabled = True
Me.GoFirst.Enabled = True
End If
However, I am trying to disable all these buttons (except the New
Record button) when there are no records on the form. I haven't
figured that one out yet. This is what I tried (unsuccessfully):
If IsNull(Me.Recordset) Then
Me.GoPrevious.Enabled = False
Me.GoFirst.Enabled = False
Me.GoNext.Enabled = False
Me.GoLast.Enabled = False
Else:
Me.GoPrevious.Enabled = True
Me.GoFirst.Enabled = True
Me.GoNext.Enabled = True
Me.GoLast.Enabled = True
End If
Thanks in advance for your help!
magmike