Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<<How can I disable object on First and Last Record?>>

Status
Not open for further replies.

nonturbo

IS-IT--Management
Aug 27, 2001
78
US
I've disabled the built-in Nav buttons, and created my own. They work and look great, but I'm having problems disabling the next/prev buttons on the first and last records. The underlying recordset is a table, and nothing too complex.

I tried adding some VBA to the OnCurrent event of the form, and was attempting to have .BOF / .EOF = True do the trick, but they dont. I can post my defunct code if needed, but I think someone else has already got this licked.

Recap: on the 1st record, I want btnPrev.Enabled = False and on last record, I want btnNext.Enabled = False.

TIA!
 
well, i don't have it licked, but i was just thinking...can you "findfirst" record, save Key ID to a variable (intfirstID), "findlast" record, save Key ID to a variable (intlastID), through the form's text boxes on the form open command... Then, all you would have to do is:

On_Next (or Prev or any)_Record_Click()

If [textbox name of Keyid on form] = intfirstID Then
btnPrev.Enabled = False
Else
'''do nothing
End IF

If [textbox name of Keyid on form] = intlastID Then
btnNext.Enabled = False
Else
'''do nothing
End If
End Sub

Then, every time a new record is added just replace the intlastID variable with the latest KeyID

What do you think?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top