Record Count Caption & Stopping Next Record If Blank

RXX00

Registered User.
Local time
Today, 05:12
Joined
May 24, 2011
Messages
26
Hi,

Any help would be a life saver.

Why is this caption record counter not working?

Me.Caption = "Record " & (Me.RecordsetClone.AbsolutePosition + 2) & " of " & Me.RecordsetClone.RecordCount

and how can I stop my code from clicking onto the next record when I have this on click of my "Next" button?

DoCmd.GoToRecord , , acNext.
 
1. Where do you have the code? It should be in the form's On Current event.

2. You might be able to use (in the same event):
Code:
If Me.NewRecord Then
   DoCmd.RunCommand acCmdRecordsGoToLast
Else
   DoCmd.RunCommand acCmdRecordsMoveNext
End If
 
Why is this caption record counter not working?

Me.Caption = "Record " & (Me.RecordsetClone.AbsolutePosition + 2) & " of " & Me.RecordsetClone.RecordCount

What do you mean by "not working"? That statement alone tells us literally nothing about the problem. Where are you putting this code? You might try;

Me.Caption = "Record " & Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount

and how can I stop my code from clicking onto the next record when I have this on click of my "Next" button?

Under what circumstance do you want this to happen? Do you want to disable the button if you're on the last record? Then something like this in the Current event of your form;

Me!cmdNext.Enabled = Me.CurrentRecord < Me.RecordsetClone.RecordCount
 
What do you mean by "not working"? That statement alone tells us literally nothing about the problem. Where are you putting this code? You might try;

Me.Caption = "Record " & Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount



Under what circumstance do you want this to happen? Do you want to disable the button if you're on the last record? Then something like this in the Current event of your form;

Me!cmdNext.Enabled = Me.CurrentRecord < Me.RecordsetClone.RecordCount

Sorry for being vague, so busy today and things wont work. :(

When the user is going through the records and gets to the last one, it takes them forward and displays an empty record, I want it to not go forward a record if the next one is empty.
 
What do you mean by "not working"? That statement alone tells us literally nothing about the problem. Where are you putting this code? You might try;

Me.Caption = "Record " & Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount

This worked great.

Thanks :)
 

Users who are viewing this thread

Back
Top Bottom