dbTalk Databases Forums  

Re: Enabling/Disabling Command Buttons Based on If Statements

comp.databases.ms-access comp.databases.ms-access


Discuss Re: Enabling/Disabling Command Buttons Based on If Statements in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Day
 
Posts: n/a

Default Re: Enabling/Disabling Command Buttons Based on If Statements - 08-04-2003 , 04:03 PM






Hi Mary Ann,
You need to check the position of the current record in the forms recordset.
ie if you are at the first record, then disable the previous record button.
As far as the last record is concerned, clicking the move next could take
the user to a new record, assuming the form is not read only. You also need
to think about the navigation buttons status for an empty recordset.

Hope this helps,
Mrk Day.

"Mary Ann" <itm (AT) itmservices (DOT) com> wrote

Quote:
I have a form with buttons to move to the previous record and next
record. If a user is on the first record, there is no previous
record. So, I want the previous record button disabled.

Is there code that says:

Is there a previous record? If so, cmdPrevRecButton.enabled=False

Then, if a user is on the last record, there is no next record. So, I
want the next record button disabled.

Please help! Thanks!



Reply With Quote
  #2  
Old   
Mary Ann Sutton
 
Posts: n/a

Default Re: Enabling/Disabling Command Buttons Based on If Statements - 08-05-2003 , 07:53 AM








How do I write the code that say:

If this is the first record in the record set?

It seems like there should be a RecordNumber so that if RecordNumber=1
Then disable previous button.

Thanks so much for the help!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #3  
Old   
Mary Ann
 
Posts: n/a

Default Re: Enabling/Disabling Command Buttons Based on If Statements - 08-05-2003 , 07:55 AM



"Mark Day" <mark.day (AT) solortec (DOT) co.uk> wrote


What is the code to check the position of the current record in the recordset?

Thanks!

Quote:
Hi Mary Ann,
You need to check the position of the current record in the forms recordset.
ie if you are at the first record, then disable the previous record button.
As far as the last record is concerned, clicking the move next could take
the user to a new record, assuming the form is not read only. You also need
to think about the navigation buttons status for an empty recordset.

Hope this helps,
Mrk Day.

"Mary Ann" <itm (AT) itmservices (DOT) com> wrote in message
news:17f5df5.0308041136.2d06ddd (AT) posting (DOT) google.com...
I have a form with buttons to move to the previous record and next
record. If a user is on the first record, there is no previous
record. So, I want the previous record button disabled.

Is there code that says:

Is there a previous record? If so, cmdPrevRecButton.enabled=False

Then, if a user is on the last record, there is no next record. So, I
want the next record button disabled.

Please help! Thanks!

Reply With Quote
  #4  
Old   
rkc
 
Posts: n/a

Default Re: Enabling/Disabling Command Buttons Based on If Statements - 08-05-2003 , 02:44 PM




"Mary Ann" <itm (AT) itmservices (DOT) com> wrote

Quote:
I have a form with buttons to move to the previous record and next
record. If a user is on the first record, there is no previous
record. So, I want the previous record button disabled.

Is there code that says:

Is there a previous record? If so, cmdPrevRecButton.enabled=False

Then, if a user is on the last record, there is no next record. So, I
want the next record button disabled.
Private Sub Form_Current()

With Me
.cmdPrevious.Enabled = Not .CurrentRecord = 1
.cmdNext.Enabled = .CurrentRecord < .RecordsetClone.RecordCount
End With

End Sub





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.