S
silva
I am using conditions to enable and disable record selection command buttons
in a form. I'm doing this to run additional scripts when navigating through
records, which I can't do simply using the standard record selection bar at
the bottom of the form window. It was working perfectly at first and then I
suppose when I made a change somewhere it doesn't work properly when the form
is first opened. It is set to diable First/Previous Record buttons when at
the first record, disable Last/Next Record buttons at the last record, and
all buttons are enabled for all records in between. Currently, when the form
loads, it disables the Last/Next Record buttons and enables the
First/Previous Record buttons, the exact opposite of what it should do. I
still have the built in record selector activated, so I use it to go to the
next record. After I do that, then it works properly from that point on, so
long as I don't completely close out the form. Here is the code used for
disabling/enabling the buttons:
If Form.CurrentRecord > 1 And Form.CurrentRecord <
Form.RecordsetClone.RecordCount Then
Next_Record_Button.Enabled = True
Previous_Record_Button.Enabled = True
Last_Record_Button.Enabled = True
First_Record_Button.Enabled = True
ElseIf Form.CurrentRecord = Form.RecordsetClone.RecordCount Then
Next_Record_Button.Enabled = False
Previous_Record_Button.Enabled = True
Last_Record_Button.Enabled = False
First_Record_Button.Enabled = True
ElseIf Form.CurrentRecord = 1 Then
Next_Record_Button.Enabled = True
Previous_Record_Button.Enabled = False
Last_Record_Button.Enabled = True
First_Record_Button.Enabled = False
End If
If there is something wrong with the code, please let me know. If there may
be some other solution to my problem, well, yeah, could use the help.
in a form. I'm doing this to run additional scripts when navigating through
records, which I can't do simply using the standard record selection bar at
the bottom of the form window. It was working perfectly at first and then I
suppose when I made a change somewhere it doesn't work properly when the form
is first opened. It is set to diable First/Previous Record buttons when at
the first record, disable Last/Next Record buttons at the last record, and
all buttons are enabled for all records in between. Currently, when the form
loads, it disables the Last/Next Record buttons and enables the
First/Previous Record buttons, the exact opposite of what it should do. I
still have the built in record selector activated, so I use it to go to the
next record. After I do that, then it works properly from that point on, so
long as I don't completely close out the form. Here is the code used for
disabling/enabling the buttons:
If Form.CurrentRecord > 1 And Form.CurrentRecord <
Form.RecordsetClone.RecordCount Then
Next_Record_Button.Enabled = True
Previous_Record_Button.Enabled = True
Last_Record_Button.Enabled = True
First_Record_Button.Enabled = True
ElseIf Form.CurrentRecord = Form.RecordsetClone.RecordCount Then
Next_Record_Button.Enabled = False
Previous_Record_Button.Enabled = True
Last_Record_Button.Enabled = False
First_Record_Button.Enabled = True
ElseIf Form.CurrentRecord = 1 Then
Next_Record_Button.Enabled = True
Previous_Record_Button.Enabled = False
Last_Record_Button.Enabled = True
First_Record_Button.Enabled = False
End If
If there is something wrong with the code, please let me know. If there may
be some other solution to my problem, well, yeah, could use the help.