PC Review


Reply
Thread Tools Rate Thread

Button1=previous record. Push Button on record zero=CRASH

 
 
Faz
Guest
Posts: n/a
 
      20th Jul 2008
how can i make button1 grayed out when the form is at record=0

Thanks
 
Reply With Quote
 
 
 
 
Jeanette Cunningham
Guest
Posts: n/a
 
      20th Jul 2008
Faz,
if using a bound form, you can find out if there are any records by counting
the records using the recordsetclone.

The following has not been tested for your exact situation

If Len(Me.RecordSource) >0 Then
If Me.RecordsetClone.RecordCount > 0 Then
Me.Button1.Enabled = True
Else
Me.Button1.Enabled = False
End If
End If

Another possibility applies if your form allows new records.
You can test the New Record property. If the form is at a new record, then
disable the button.

If Me.NewRecord = True Then
Me.Button.Enabled = False
Else
Me.Button.Enabled = True
End If

You would need the code on the On Current event of the form
and on any other event that could change the record source of the form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Faz" <(E-Mail Removed)> wrote in message
news:35744C2D-EBEF-456F-8ED9-(E-Mail Removed)...
> how can i make button1 grayed out when the form is at record=0
>
> Thanks



 
Reply With Quote
 
Faz
Guest
Posts: n/a
 
      21st Jul 2008
Thank you very much

"Jeanette Cunningham" wrote:

> Faz,
> if using a bound form, you can find out if there are any records by counting
> the records using the recordsetclone.
>
> The following has not been tested for your exact situation
>
> If Len(Me.RecordSource) >0 Then
> If Me.RecordsetClone.RecordCount > 0 Then
> Me.Button1.Enabled = True
> Else
> Me.Button1.Enabled = False
> End If
> End If
>
> Another possibility applies if your form allows new records.
> You can test the New Record property. If the form is at a new record, then
> disable the button.
>
> If Me.NewRecord = True Then
> Me.Button.Enabled = False
> Else
> Me.Button.Enabled = True
> End If
>
> You would need the code on the On Current event of the form
> and on any other event that could change the record source of the form.
>
>
> Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>
> "Faz" <(E-Mail Removed)> wrote in message
> news:35744C2D-EBEF-456F-8ED9-(E-Mail Removed)...
> > how can i make button1 grayed out when the form is at record=0
> >
> > Thanks

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Button shows previous record before current record is delet =?Utf-8?B?UmljaDEyMzQ=?= Microsoft Access Forms 8 10th Oct 2005 01:15 PM
How to display set of record s on the forms using previous & next button jophy j via OfficeKB.com Microsoft Excel Programming 0 21st Jul 2005 07:02 AM
Current Record Count, Previous Record #, Add New Record =?Utf-8?B?Um9iZXJ0IE51c3ogQCBEUFM=?= Microsoft Access Forms 0 15th Feb 2005 08:35 PM
Copy Value From Previous record Using Only Command Button 1aae Microsoft Access Form Coding 0 25th Apr 2004 04:40 PM
Duplicate Record Command Button goes to previous record Bdehning Microsoft Access Forms 2 9th Feb 2004 06:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 PM.