Thank you that worked great. Just for my knowledge what does the .EOF do and mean?
"Dirk Goldgar" wrote:
[Quoted Text] > "Cmenkedi" <Cmenkedi[ at ]discussions.microsoft.com> wrote in message > news:F887B79C-5759-4168-96BF-D1D7EC697BF7[ at ]microsoft.com... > > Hello, > > I am hiving trouble with recordsetclone. > > I have a form that I open and want to display the number of records. The > > code that I am using is: > > Set rst = Me.RecordsetClone > > Me.txtRecordNumber = Me.CurrentRecord > > Me.txtRecords = rst.RecordCount & " record" & IIf(rst.RecordCount = 1, "", > > "s") > > > > The txtRecords box will only show 1 record when there is more then one. > > The > > wierd part of this problem is that if I go into debug and go line by line > > through code it works perfectly. I am at a loss as to why it doesn't > > work. > > I have it on 2 forms and neither works. > > > You probably need to move the recordsetclone to the last record to get the > record count. Try this: > > Me.txtRecordNumber = Me.CurrentRecord > With Me.RecordsetClone > If Not .EOF Then .MoveLast > Me.txtRecords = .RecordCount & " record" & _ > IIf(.RecordCount = 1, "", "s") > End With > > -- > Dirk Goldgar, MS Access MVP > www.datagnostics.com > > (please reply to the newsgroup) > >
|